Provide local paths for file tests. (#2830)

The intent of this change is that instead of paths looking like `explorer/testdata/foo/bar.carbon` (repo-relative), they're now just `bar.carbon` (local). The consequence is that paths should be a bit more durable in various environments, and just paths should be shorter and easier to read.

The explorer's prelude is an exception to this since it comes from data, rather than being the test target. Due to the change in approaches, it needs the regex again.

Uses #2829
This commit is contained in:
Jon Ross-Perkins
2023-05-18 10:20:51 -07:00
committed by GitHub
parent 3c15882f4e
commit 6b7a522b3f
495 changed files with 701 additions and 641 deletions
@@ -9,7 +9,7 @@ package ExplorerTest api;
fn Bad[T:! type](x: {.a: i32, .b: T}) {}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T}`
// CHECK:STDERR: COMPILATION ERROR: fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T}`
Bad({.b = 5, .a = 7, .c = 2});
return 0;
}
@@ -9,7 +9,7 @@ package ExplorerTest api;
fn Bad[T:! type](x: {.a: i32, .b: T}) {}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}`
// CHECK:STDERR: COMPILATION ERROR: fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}`
Bad({.a = 5});
return 0;
}
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/generic_function/fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
// CHECK:STDERR: SYNTAX ERROR: fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
fn F[T: type]();
fn Main() -> i32 {
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn id[T:! type](x: T) -> T {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
// CHECK:STDERR: COMPILATION ERROR: fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
// CHECK:STDERR: could not find implementation of interface AddWith(U = i32) for T
return x + 0;
}
+1 -1
View File
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
fn F[a:! 42]();
fn Main() -> i32 {
@@ -11,7 +11,7 @@ fn fst[T:! type](x: T, y: T) -> T {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
// CHECK:STDERR: COMPILATION ERROR: fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
// CHECK:STDERR: i32
// CHECK:STDERR: bool
return fst(0, true);
@@ -11,6 +11,6 @@ fn id[T:! type](x: i32) -> i32 {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_type_deduction_unused.carbon:[[@LINE+1]]: could not deduce type argument for type parameter T in call
// CHECK:STDERR: COMPILATION ERROR: fail_type_deduction_unused.carbon:[[@LINE+1]]: could not deduce type argument for type parameter T in call
return id(0);
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
class C {}
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/generic_function/fail_type_only.carbon:[[@LINE+1]]: syntax error, unexpected RIGHT_SQUARE_BRACKET, expecting COLON
// CHECK:STDERR: SYNTAX ERROR: fail_type_only.carbon:[[@LINE+1]]: syntax error, unexpected RIGHT_SQUARE_BRACKET, expecting COLON
fn f[x:! i32, addr C]() {}
fn Main() -> i32 {
@@ -13,7 +13,7 @@ fn Get[T:! ()](n: T) -> i32 { return 2; }
fn Main() -> i32 {
var x : X = {};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_function/fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
Get(x);
return 0;
}