better copilot test (#1741)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
		@ -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();
 | 
			
		||||
@ -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();
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user