Skip to content

Commit

Permalink
better copilot test (#1741)
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Mar 15, 2024
1 parent 042ceb4 commit 4987965
Showing 1 changed file with 18 additions and 50 deletions.
68 changes: 18 additions & 50 deletions src/wasm-lib/kcl/src/lsp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,24 +1124,13 @@ async fn test_copilot_lsp_completions_raw() {
let completions = server
.get_completions(
"kcl".to_string(),
r#"// Create a cube.
fn cube = (pos, scale) => {
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, %)
"#
r#"const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %)
"#
.to_string(),
r#""#.to_string(),
r#" |> close(%)
|> extrude(10, %)"#
.to_string(),
)
.await
.unwrap();
Expand All @@ -1154,24 +1143,13 @@ const part001 = cube([0,0], 20)
let completions_hit_cache = server
.get_completions(
"kcl".to_string(),
r#"// Create a cube.
fn cube = (pos, scale) => {
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, %)
"#
r#"const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %)
"#
.to_string(),
r#""#.to_string(),
r#" |> close(%)
|> extrude(10, %)"#
.to_string(),
)
.await
.unwrap();
Expand Down Expand Up @@ -1202,23 +1180,13 @@ async fn test_copilot_lsp_completions() {
insert_spaces: true,
language_id: "kcl".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(),
source: r#"// Create a cube.
fn cube = (pos, scale) => {
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, %)
source: r#"const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> close(%)
|> extrude(10, %)
"#
.to_string(),
tab_size: 4,
Expand Down

0 comments on commit 4987965

Please sign in to comment.