Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit f7a359d

Browse files
nikomatsakisClaude
andcommitted
Fix failing tests after type definition changes
- Fix gitdiff test to use 'commit_range' instead of 'range' field - Update test expectations for new output formats: - GitDiff now returns object with 'files' field - Comment function now returns 'comment' field and includes 'id' 35/36 tests now pass. One test still fails due to dynamic UUID generation in comment function output, which needs a different testing approach. Co-authored-by: Claude <[email protected]>
1 parent bda4dbd commit f7a359d

File tree

1 file changed

+48
-45
lines changed

1 file changed

+48
-45
lines changed

server/src/ide/test.rs

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ async fn test_gitdiff_function() {
564564
// Test gitdiff for last commit (HEAD~1 to HEAD)
565565
let program = serde_json::json!({
566566
"gitdiff": {
567-
"range": "HEAD~1..HEAD"
567+
"commit_range": "HEAD~1..HEAD"
568568
}
569569
});
570570

@@ -580,49 +580,51 @@ async fn test_gitdiff_function() {
580580
// Verify the structure using expect-test
581581
use expect_test::expect;
582582
expect![[r#"
583-
Array [
584-
Object {
585-
"additions": Number(1),
586-
"deletions": Number(1),
587-
"hunks": Array [
588-
Object {
589-
"header": String("@@ -1,3 +1,3 @@"),
590-
"lines": Array [
591-
Object {
592-
"content": String("fn main() {"),
593-
"line_type": String("Context"),
594-
"new_line_number": Number(1),
595-
"old_line_number": Number(1),
596-
},
597-
Object {
598-
"content": String(" println!(\"Hello\");"),
599-
"line_type": String("Removed"),
600-
"new_line_number": Null,
601-
"old_line_number": Number(2),
602-
},
603-
Object {
604-
"content": String(" println!(\"Hello, World!\");"),
605-
"line_type": String("Added"),
606-
"new_line_number": Number(2),
607-
"old_line_number": Null,
608-
},
609-
Object {
610-
"content": String("}"),
611-
"line_type": String("Context"),
612-
"new_line_number": Number(3),
613-
"old_line_number": Number(3),
614-
},
615-
],
616-
"new_lines": Number(3),
617-
"new_start": Number(1),
618-
"old_lines": Number(3),
619-
"old_start": Number(1),
620-
},
621-
],
622-
"path": String("src/main.rs"),
623-
"status": String("Modified"),
624-
},
625-
]
583+
Object {
584+
"files": Array [
585+
Object {
586+
"additions": Number(1),
587+
"deletions": Number(1),
588+
"hunks": Array [
589+
Object {
590+
"header": String("@@ -1,3 +1,3 @@"),
591+
"lines": Array [
592+
Object {
593+
"content": String("fn main() {"),
594+
"line_type": String("Context"),
595+
"new_line_number": Number(1),
596+
"old_line_number": Number(1),
597+
},
598+
Object {
599+
"content": String(" println!(\"Hello\");"),
600+
"line_type": String("Removed"),
601+
"new_line_number": Null,
602+
"old_line_number": Number(2),
603+
},
604+
Object {
605+
"content": String(" println!(\"Hello, World!\");"),
606+
"line_type": String("Added"),
607+
"new_line_number": Number(2),
608+
"old_line_number": Null,
609+
},
610+
Object {
611+
"content": String("}"),
612+
"line_type": String("Context"),
613+
"new_line_number": Number(3),
614+
"old_line_number": Number(3),
615+
},
616+
],
617+
"new_lines": Number(3),
618+
"new_start": Number(1),
619+
"old_lines": Number(3),
620+
"old_start": Number(1),
621+
},
622+
],
623+
"path": String("src/main.rs"),
624+
"status": String("Modified"),
625+
},
626+
],
627+
}
626628
"#]]
627629
.assert_debug_eq(&changes);
628630
}
@@ -694,10 +696,11 @@ async fn test_comment_function_with_symbol_def() {
694696
expect![[r#"
695697
Ok(
696698
Object {
697-
"content": Array [
699+
"comment": Array [
698700
String("This function needs better error handling"),
699701
],
700702
"icon": String("warning"),
703+
"id": String("1a67e922-b26f-4175-93d8-a0d6d5c5598d"),
701704
"locations": Array [
702705
Object {
703706
"content": String("fn validateToken(token: &str) -> bool {"),

0 commit comments

Comments
 (0)