From d22ab4afe4826e502b64b6bbf736ab61584ba697 Mon Sep 17 00:00:00 2001 From: he1pa <18012015693@163.com> Date: Thu, 19 Sep 2024 15:45:20 +0800 Subject: [PATCH] remove deprecated unit test Signed-off-by: he1pa <18012015693@163.com> --- kclvm/parser/src/lib.rs | 2 ++ kclvm/tools/src/LSP/src/tests.rs | 27 --------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/kclvm/parser/src/lib.rs b/kclvm/parser/src/lib.rs index 8901177d0..01648af22 100644 --- a/kclvm/parser/src/lib.rs +++ b/kclvm/parser/src/lib.rs @@ -1065,6 +1065,8 @@ pub fn parse_kcl_file( // Add the external package name as prefix of the [`kclvm_ast::ImportStmt`]'s member [`path`]. import_spec.path.node = pkg_info.pkg_path.to_string(); import_spec.pkg_name = pkg_info.pkg_name.clone(); + // If k_files is empty, the pkg information will not be found in the file graph. + // Record the empty pkg to prevent loss. After the parse file is completed, fill in the modules pkgs.insert(pkg_info.pkg_path.clone(), vec![]); // Add file dependencies. let mut paths: Vec = pkg_info diff --git a/kclvm/tools/src/LSP/src/tests.rs b/kclvm/tools/src/LSP/src/tests.rs index 610f65386..9e851f5b5 100644 --- a/kclvm/tools/src/LSP/src/tests.rs +++ b/kclvm/tools/src/LSP/src/tests.rs @@ -1,7 +1,6 @@ use crossbeam_channel::after; use crossbeam_channel::select; use indexmap::IndexSet; -use kclvm_ast::MAIN_PKG; use kclvm_driver::lookup_compile_workspace; use kclvm_driver::toolchain; use kclvm_driver::toolchain::Metadata; @@ -2104,32 +2103,6 @@ fn rename_test() { assert_eq!(res.result.unwrap(), to_json(expect).unwrap()); } -#[test] -fn compile_unit_test() { - let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let mut test_file = path.clone(); - test_file.push("src/test_data/compile_unit/b.k"); - let file = test_file.to_str().unwrap(); - - let prog = compile_with_params(Params { - file: Some(file.to_string()), - module_cache: None, - scope_cache: None, - vfs: Some(KCLVfs::default()), - gs_cache: Some(KCLGlobalStateCache::default()), - }) - .1 - .unwrap() - .0; - // b.k is not contained in kcl.yaml but need to be contained in main pkg - assert!(prog - .pkgs - .get(MAIN_PKG) - .unwrap() - .iter() - .any(|m| m.filename == file)) -} - #[test] fn kcl_workspace_init_kclwork_test() { let tool: crate::state::KCLToolChain = Arc::new(RwLock::new(toolchain::default()));