From 9465e0e2cf77c0a23abe077a02531b298188e24c Mon Sep 17 00:00:00 2001 From: he1pa <18012015693@163.com> Date: Tue, 25 Jun 2024 21:01:16 +0800 Subject: [PATCH] update ut Signed-off-by: he1pa <18012015693@163.com> --- kclvm/tools/src/LSP/src/completion.rs | 3 ++- .../kcl_language_server__completion__tests__lambda_1.snap | 5 +++++ ...cl_language_server__completion__tests__lambda_1.snap.new | 6 ------ 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap delete mode 100644 kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap.new diff --git a/kclvm/tools/src/LSP/src/completion.rs b/kclvm/tools/src/LSP/src/completion.rs index b4e9ed2a2..c8a1e147c 100644 --- a/kclvm/tools/src/LSP/src/completion.rs +++ b/kclvm/tools/src/LSP/src/completion.rs @@ -1844,8 +1844,9 @@ mod tests { match &mut got { CompletionResponse::Array(arr) => { - let labels: Vec = + let mut labels: Vec = arr.iter().map(|item| item.label.clone()).collect(); + labels.sort(); insta::assert_snapshot!(format!("{:?}", labels)); } CompletionResponse::List(_) => panic!("test failed"), diff --git a/kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap b/kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap new file mode 100644 index 000000000..31b3c212e --- /dev/null +++ b/kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap @@ -0,0 +1,5 @@ +--- +source: tools/src/LSP/src/completion.rs +expression: "format!(\"{:?}\", labels)" +--- +["abs(…)", "all_true(…)", "any_true(…)", "bin(…)", "bool(…)", "case", "cases", "dict(…)", "float(…)", "func1", "hex(…)", "int(…)", "isunique(…)", "len(…)", "list(…)", "max(…)", "min(…)", "multiplyof(…)", "oct(…)", "option(…)", "ord(…)", "pow(…)", "print(…)", "range(…)", "round(…)", "sorted(…)", "str(…)", "sum(…)", "typeof(…)", "zip(…)"] diff --git a/kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap.new b/kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap.new deleted file mode 100644 index 797ccdad1..000000000 --- a/kclvm/tools/src/LSP/src/snapshots/kcl_language_server__completion__tests__lambda_1.snap.new +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: tools/src/LSP/src/completion.rs -assertion_line: 1863 -expression: "format!(\"{:?}\", labels)" ---- -["option(…)", "print(…)", "multiplyof(…)", "isunique(…)", "len(…)", "abs(…)", "all_true(…)", "any_true(…)", "hex(…)", "bin(…)", "oct(…)", "ord(…)", "sorted(…)", "range(…)", "max(…)", "min(…)", "sum(…)", "pow(…)", "round(…)", "zip(…)", "int(…)", "float(…)", "bool(…)", "str(…)", "list(…)", "dict(…)", "typeof(…)", "case", "func1", "cases"]