add factory test
This commit is contained in:
parent
dbac4132d0
commit
7da5f83661
@ -15,6 +15,9 @@ const TEST_FILE: &str = "/home/dide/project/Digital-Test/MipsDesign/src/MyCpu.v"
|
|||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
const INCOMPLETE_EXAMPLE: &str = "/home/dide/project/Digital-Test/Digital-IDE-test/user/src/incomplete-example";
|
const INCOMPLETE_EXAMPLE: &str = "/home/dide/project/Digital-Test/Digital-IDE-test/user/src/incomplete-example";
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
|
const DIGTIAL_IDE_FACTORY: &str = "/home/dide/project/Digital-Test/Digital-IDE-test/user/factory";
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
const TESTFILES_TEMP_DIR: &str = "/home/dide/project/Digital-Test/Digital-IDE-temp";
|
const TESTFILES_TEMP_DIR: &str = "/home/dide/project/Digital-Test/Digital-IDE-temp";
|
||||||
|
|
||||||
@ -103,6 +106,20 @@ mod test_fast {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_factory() {
|
||||||
|
// 判断路径是否存在且为文件夹
|
||||||
|
let path = Path::new(DIGTIAL_IDE_FACTORY);
|
||||||
|
if path.exists() && path.is_dir() {
|
||||||
|
// 递归遍历文件夹
|
||||||
|
if let Err(e) = traverse_directory(path) {
|
||||||
|
eprintln!("Error: {}", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("Path does not exist or is not a directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mips_design() {
|
fn test_mips_design() {
|
||||||
// 判断路径是否存在且为文件夹
|
// 判断路径是否存在且为文件夹
|
||||||
@ -184,7 +201,7 @@ mod test_svparse {
|
|||||||
use tower_lsp::lsp_types::{Position, Range, Url};
|
use tower_lsp::lsp_types::{Position, Range, Url};
|
||||||
use crate::sources::recovery_sv_parse_with_retry;
|
use crate::sources::recovery_sv_parse_with_retry;
|
||||||
|
|
||||||
use super::{INCOMPLETE_EXAMPLE, TEST_FILE};
|
use super::{INCOMPLETE_EXAMPLE, TEST_FILE, DIGTIAL_IDE_FACTORY};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
/// 测试单独的文件
|
/// 测试单独的文件
|
||||||
@ -229,6 +246,19 @@ mod test_svparse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_factory() {
|
||||||
|
let path = Path::new(DIGTIAL_IDE_FACTORY);
|
||||||
|
if path.exists() && path.is_dir() {
|
||||||
|
// 递归遍历文件夹
|
||||||
|
if let Err(e) = traverse_directory(path) {
|
||||||
|
eprintln!("Error: {}", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("Path does not exist or is not a directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn traverse_directory(dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
fn traverse_directory(dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if dir.is_dir() {
|
if dir.is_dir() {
|
||||||
for entry in fs::read_dir(dir)? {
|
for entry in fs::read_dir(dir)? {
|
||||||
@ -367,6 +397,19 @@ mod test_scope_tree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_factory() {
|
||||||
|
let path = Path::new(DIGTIAL_IDE_FACTORY);
|
||||||
|
if path.exists() && path.is_dir() {
|
||||||
|
// 递归遍历文件夹
|
||||||
|
if let Err(e) = traverse_directory(path) {
|
||||||
|
eprintln!("Error: {}", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("Path does not exist or is not a directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn traverse_directory(dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
fn traverse_directory(dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if dir.is_dir() {
|
if dir.is_dir() {
|
||||||
for entry in fs::read_dir(dir)? {
|
for entry in fs::read_dir(dir)? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user