better copilot test (#1741)

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-03-15 13:07:02 -07:00
committed by GitHub
parent 042ceb42fd
commit 4987965731

View File

@ -1124,24 +1124,13 @@ async fn test_copilot_lsp_completions_raw() {
let completions = server let completions = server
.get_completions( .get_completions(
"kcl".to_string(), "kcl".to_string(),
r#"// Create a cube. r#"const bracket = startSketchOn('XY')
fn cube = (pos, scale) => { |> startProfileAt([0, 0], %)
const sg = startSketchOn('XY') "#
|> startProfileAt(pos, %)
|> line([0, scale], %)
|> line([scale, 0], %)
|> line([0, -scale], %)
return sg
}
const part001 = cube([0,0], 20)
|> close(%)
|> extrude(20, %)
"#
.to_string(), .to_string(),
r#""#.to_string(), r#" |> close(%)
|> extrude(10, %)"#
.to_string(),
) )
.await .await
.unwrap(); .unwrap();
@ -1154,24 +1143,13 @@ const part001 = cube([0,0], 20)
let completions_hit_cache = server let completions_hit_cache = server
.get_completions( .get_completions(
"kcl".to_string(), "kcl".to_string(),
r#"// Create a cube. r#"const bracket = startSketchOn('XY')
fn cube = (pos, scale) => { |> startProfileAt([0, 0], %)
const sg = startSketchOn('XY') "#
|> startProfileAt(pos, %)
|> line([0, scale], %)
|> line([scale, 0], %)
|> line([0, -scale], %)
return sg
}
const part001 = cube([0,0], 20)
|> close(%)
|> extrude(20, %)
"#
.to_string(), .to_string(),
r#""#.to_string(), r#" |> close(%)
|> extrude(10, %)"#
.to_string(),
) )
.await .await
.unwrap(); .unwrap();
@ -1202,23 +1180,13 @@ async fn test_copilot_lsp_completions() {
insert_spaces: true, insert_spaces: true,
language_id: "kcl".to_string(), language_id: "kcl".to_string(),
path: "file:///test.copilot".to_string(), path: "file:///test.copilot".to_string(),
position: crate::lsp::copilot::types::CopilotPosition { line: 0, character: 1 }, position: crate::lsp::copilot::types::CopilotPosition { line: 3, character: 3 },
relative_path: "test.copilot".to_string(), relative_path: "test.copilot".to_string(),
source: r#"// Create a cube. source: r#"const bracket = startSketchOn('XY')
fn cube = (pos, scale) => { |> startProfileAt([0, 0], %)
const sg = startSketchOn('XY')
|> startProfileAt(pos, %) |> close(%)
|> line([0, scale], %) |> extrude(10, %)
|> line([scale, 0], %)
|> line([0, -scale], %)
return sg
}
const part001 = cube([0,0], 20)
|> close(%)
|> extrude(20, %)
"# "#
.to_string(), .to_string(),
tab_size: 4, tab_size: 4,