Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <18012015693@163.com>
  • Loading branch information
He1pa committed Oct 12, 2024
1 parent e6cfb91 commit 5b389bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions kclvm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions kclvm/query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ kclvm-ast-pretty = {path = "../ast_pretty"}
kclvm-parser = {path = "../parser"}
kclvm-sema = {path = "../sema"}
kclvm-error = {path = "../error"}
kclvm-utils ={ path = "../utils"}
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
fancy-regex = "0.7.1"
Expand Down
5 changes: 3 additions & 2 deletions kclvm/query/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
};
use kclvm_error::{DiagnosticId, ErrorKind, Level};
use kclvm_parser::parse_file_force_errors;
use kclvm_utils::path::PathPrefix;
use pretty_assertions::assert_eq;
use selector::ListOptions;

Expand Down Expand Up @@ -887,8 +888,8 @@ fn test_overridefile_with_invalid_kcl() {
"expected one of [\"=\"] got eof"
);
assert_eq!(
result.parse_errors[0].messages[0].range.0.filename,
simple_path.display().to_string()
result.parse_errors[0].messages[0].range.0.filename.adjust_canonicalization(),
simple_path.display().to_string().adjust_canonicalization()
);
assert_eq!(result.parse_errors[0].messages[0].range.0.line, 1);
assert_eq!(result.parse_errors[0].messages[0].range.0.column, Some(8));
Expand Down
9 changes: 5 additions & 4 deletions kclvm/tools/src/LSP/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ fn goto_import_pkg_with_line_test() {
let (file, _program, _, gs) =
compile_test_file("src/test_data/goto_def_with_line_test/main_pkg/main.k");
let pos = KCLPos {
filename: file,
filename: file.adjust_canonicalization(),
line: 1,
column: Some(27),
};
Expand All @@ -479,7 +479,8 @@ fn goto_import_pkg_with_line_test() {
.canonicalize()
.unwrap()
.display()
.to_string();
.to_string()
.adjust_canonicalization();
assert_eq!(got_path, expected_path)
}
_ => {
Expand Down Expand Up @@ -533,7 +534,7 @@ fn complete_import_external_file_test() {
.unwrap();

let pos = KCLPos {
filename: path.to_string(),
filename: path.to_string().adjust_canonicalization(),
line: 1,
column: Some(11),
};
Expand Down Expand Up @@ -595,7 +596,7 @@ fn goto_import_external_file_test() {

// test goto import file: import .pkg.schema_def
let pos = KCLPos {
filename: path.to_string(),
filename: path.to_string().adjust_canonicalization(),
line: 1,
column: Some(57),
};
Expand Down

0 comments on commit 5b389bc

Please sign in to comment.