Skip to content

Commit

Permalink
add ut
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <18012015693@163.com>
  • Loading branch information
He1pa committed Nov 21, 2024
1 parent 15e2ef0 commit 3eab378
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 2 deletions.
26 changes: 24 additions & 2 deletions kclvm/tools/src/LSP/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,22 @@ mod tests {

let mut expected_labels: Vec<String> = vec![
"", // generate from error recovery of "pkg."
"subpkg", "math", "Person", "Person{}", "P", "P{}", "p", "p1", "p2", "p3", "p4",
"aaaa", "Config", "Config{}", "n",
"subpkg",
"math",
"Person",
"Person1{}",
"Person{}",
"P",
"P{}",
"p",
"p1",
"p2",
"p3",
"p4",
"aaaa",
"Config",
"Config{}",
"n",
]
.iter()
.map(|s| s.to_string())
Expand Down Expand Up @@ -2298,4 +2312,12 @@ mod tests {
23,
Some('.')
);

completion_label_without_builtin_func_test_snapshot!(
complete_unimport_schemas,
"src/test_data/completion_test/unimport/unimport/main.k",
1,
1,
None
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: tools/src/LSP/src/completion.rs
expression: "format! (\"{:?}\", got_labels)"
---
["Name{}(import pkg)", "SubPKg{}(import subpkg)"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "pkg"
edition = "v0.9.0"
version = "0.0.1"


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema Name:
name: str
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "unimport"
edition = "v0.9.0"
version = "0.0.1"

[dependencies]
pkg = { path = "../pkg" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema SubPKg:
name: str

0 comments on commit 3eab378

Please sign in to comment.