Skip to content

Commit

Permalink
test: fix lsp unit test of find ref. (kcl-lang#845)
Browse files Browse the repository at this point in the history
test: fix lsp unit test of find ref. use thread sleep to aysnc build word index map

Signed-off-by: He1pa <[email protected]>
  • Loading branch information
He1pa authored Nov 6, 2023
1 parent ded5040 commit 7f146e2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions kclvm/tools/src/LSP/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,10 @@ fn find_refs_test() {
name: "test".to_string(),
}]);
let server = Project {}.server(initialize_params);

// Wait for async build word_index_map
thread::sleep(Duration::from_secs(1));

let url = Url::from_file_path(path).unwrap();

// Mock open file
Expand Down Expand Up @@ -1504,6 +1508,10 @@ fn find_refs_with_file_change_test() {
name: "test".to_string(),
}]);
let server = Project {}.server(initialize_params);

// Wait for async build word_index_map
thread::sleep(Duration::from_secs(1));

let url = Url::from_file_path(path).unwrap();

// Mock open file
Expand Down Expand Up @@ -1603,6 +1611,10 @@ fn rename_test() {
name: "test".to_string(),
}]);
let server = Project {}.server(initialize_params);

// Wait for async build word_index_map
thread::sleep(Duration::from_secs(1));

let url = Url::from_file_path(path).unwrap();
let main_url = Url::from_file_path(main_path).unwrap();

Expand All @@ -1617,8 +1629,6 @@ fn rename_test() {
},
},
);
// Wait fro async build word_index_map
thread::sleep(Duration::from_secs(1));

let id = server.next_request_id.get();
server.next_request_id.set(id.wrapping_add(1));
Expand Down

0 comments on commit 7f146e2

Please sign in to comment.