Skip to content

Commit

Permalink
test: sort result in 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 16, 2023
1 parent 8ddbc58 commit 35af12d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions kclvm/tools/src/LSP/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,12 @@ mod tests {
column: Some(4),
};

let got = completion(Some('\n'), &program, &pos, &prog_scope, &gs).unwrap();
match got {
let mut got = completion(Some('\n'), &program, &pos, &prog_scope, &gs).unwrap();
match &mut got {
CompletionResponse::Array(arr) => {
arr.sort_by(|a, b| a.label.cmp(&b.label));
assert_eq!(
arr[0],
arr[1],
CompletionItem {
label: "c".to_string(),
kind: Some(CompletionItemKind::FIELD),
Expand All @@ -1099,9 +1100,10 @@ mod tests {
column: Some(4),
};

let got = completion(Some('\n'), &program, &pos, &prog_scope, &gs).unwrap();
match got {
let mut got = completion(Some('\n'), &program, &pos, &prog_scope, &gs).unwrap();
match &mut got {
CompletionResponse::Array(arr) => {
arr.sort_by(|a, b| a.label.cmp(&b.label));
assert_eq!(
arr[0],
CompletionItem {
Expand Down

0 comments on commit 35af12d

Please sign in to comment.