Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <[email protected]>
  • Loading branch information
He1pa committed Oct 23, 2024
1 parent 512b916 commit 4dae3a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion kclvm/parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ pub struct ParseFileResult {

/// Parse a KCL file to the AST module with parse errors.
pub fn parse_single_file(filename: &str, code: Option<String>) -> Result<ParseFileResult> {
let filename = filename.adjust_canonicalization();
let sess = Arc::new(ParseSession::default());
let mut loader = Loader::new(
sess,
&[filename],
&[&filename],
Some(LoadProgramOptions {
load_packages: false,
k_code_list: if let Some(code) = code {
Expand Down
5 changes: 4 additions & 1 deletion kclvm/query/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,10 @@ fn test_list_variable_with_invalid_kcl() {
result.parse_errors[0].messages[0].message,
"expected one of [\"=\"] got eof",
);
assert_eq!(result.parse_errors[0].messages[0].range.0.filename, file);
assert_eq!(
result.parse_errors[0].messages[0].range.0.filename,
file.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

0 comments on commit 4dae3a6

Please sign in to comment.