We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- gotodef - case1 - case1.k - case2 - case2.k - ... - hover - ...
fn case1_test(){ } fn case2_test(){ }
insta
assert
e.g. from
#[test] #[bench_test] fn lambda_local_var_test() { let (file, _program, _, gs) = compile_test_file("src/test_data/goto_def_test/goto_def.k"); let pos = KCLPos { filename: file.clone(), line: 96, column: Some(9), }; let res = goto_def(&pos, &gs); compare_goto_res(res, (&file, 94, 11, 94, 12)); }
to
#[macro_export] macro_rules! goto_def_test_snapshot { ($name:ident, $file:expr, $line:expr, $column: expr) => { #[test] fn $name() { insta::assert_snapshot!(format!("{:?}", { let (file, _program, _, gs) = compile_test_file($file); let pos = KCLPos { filename: file.clone(), line: $line, column: Some($column), }; goto_def(&pos, &gs) })); } }; } goto_def_test_snapshot!( lambda_local_var_test, "src/test_data/goto_def_test/goto_def.k", 96, 9 );
Abstraction some test function for e2e tests(in kclvm/tools/src/LSP/src/tests.rs), e.g.,
// Mock open file server.notification::<lsp_types::notification::DidOpenTextDocument>( lsp_types::DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url::from_file_path(path).unwrap(), language_id: "KCL".to_string(), version: 0, text: src, }, }, ); // Mock close file server.notification::<lsp_types::notification::DidCloseTextDocument>( lsp_types::DidCloseTextDocumentParams { text_document: TextDocumentIdentifier { uri: Url::from_file_path(path).unwrap(), }, }, ); // Mock for complete request let id = server.next_request_id.get(); server.next_request_id.set(id.wrapping_add(1)); let r: Request = Request::new( id.into(), "textDocument/completion".to_string(), CompletionParams { text_document_position: TextDocumentPositionParams { text_document: TextDocumentIdentifier { uri: Url::from_file_path(path).unwrap(), }, position: Position::new(11, 7), }, work_done_progress_params: Default::default(), partial_result_params: Default::default(), context: Some(CompletionContext { trigger_kind: CompletionTriggerKind::TRIGGER_CHARACTER, trigger_character: Some(".".to_string()), }), }, ); // Send request and wait for it's response let res = server.send_and_receive(r);
Abstracte to
Impl Server{ fn open_file(){} fn close_file(){} fn complete() -> Resp{} fn goto_def() -> Resp{} ... }
And refactor e2e test
The text was updated successfully, but these errors were encountered:
@He1pa I would like to work on this issue
Sorry, something went wrong.
@He1pa This sounds like a good issue to get started with! Will try and do this for the completion module!
Successfully merging a pull request may close this issue.
Enhancement
1 Unit test
insta
pkg instead ofassert
in test codee.g. from
to
e2e test
Abstraction some test function for e2e tests(in kclvm/tools/src/LSP/src/tests.rs), e.g.,
Abstracte to
And refactor e2e test
The text was updated successfully, but these errors were encountered: