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
+1 -1
View File
@@ -9,7 +9,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var t1: (i32, i32) = (5, 2);
var t2: (i32,) = (5,);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_equality_type.carbon:[[@LINE+1]]: (i32, i32) is not equality comparable with (i32,) (could not find implementation of interface EqWith(U = (i32,)) for (i32, i32))
// CHECK:STDERR: COMPILATION ERROR: fail_equality_type.carbon:[[@LINE+1]]: (i32, i32) is not equality comparable with (i32,) (could not find implementation of interface EqWith(U = (i32,)) for (i32, i32))
if (t1 == t2) {
return 1;
} else {
@@ -19,7 +19,7 @@ external impl A as As(B) {
fn Main() -> i32 {
var a: (i32, A) = (1, {.a = 2});
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_implicit_convert_with_as.carbon:[[@LINE+1]]: type error in initializer of variable: '(i32, class A)' is not implicitly convertible to '(i32, class B)'
// CHECK:STDERR: COMPILATION ERROR: fail_implicit_convert_with_as.carbon:[[@LINE+1]]: type error in initializer of variable: '(i32, class A)' is not implicitly convertible to '(i32, class B)'
var b: (i32, B) = a;
return b[1].b;
}
+1 -1
View File
@@ -8,6 +8,6 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: auto = (0, 1);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_index.carbon:[[@LINE+1]]: index 2 is out of range for type (i32, i32)
// CHECK:STDERR: COMPILATION ERROR: fail_index.carbon:[[@LINE+1]]: index 2 is out of range for type (i32, i32)
return x[2];
}
+1 -1
View File
@@ -9,6 +9,6 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: auto = (0, 1);
var index: i32 = 0;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_index_var.carbon:[[@LINE+1]]: could not find `index: i32`
// CHECK:STDERR: COMPILATION ERROR: fail_index_var.carbon:[[@LINE+1]]: could not find `index: i32`
return x[index];
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_length_mismatch_with_auto.carbon:[[@LINE+1]]: tuples of different length
// CHECK:STDERR: COMPILATION ERROR: fail_length_mismatch_with_auto.carbon:[[@LINE+1]]: tuples of different length
var a: (auto,) = (1, 2);
return 0;
}
+1 -1
View File
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon:[[@LINE+1]]: type error in type of name binding: '(i32, i32)' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_nontype_tuple_as_type.carbon:[[@LINE+1]]: type error in type of name binding: '(i32, i32)' is not implicitly convertible to 'type'
fn F[T:! (i32, i32)](x: T);
fn Main() -> i32;
+1 -1
View File
@@ -8,6 +8,6 @@ package ExplorerTest api;
fn Main() -> i32 {
var t: auto = (1, 2);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_to_array.carbon:[[@LINE+1]]: type error in initializer of variable: '(i32, i32)' is not implicitly convertible to '[i32; 3]'
// CHECK:STDERR: COMPILATION ERROR: fail_to_array.carbon:[[@LINE+1]]: type error in initializer of variable: '(i32, i32)' is not implicitly convertible to '[i32; 3]'
var a: [i32; 3] = t;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn F[T:! ((), ())](x: T) -> () {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_type_tuple_as_type.carbon:[[@LINE+1]]: only arrays and tuples can be indexed, found T
// CHECK:STDERR: COMPILATION ERROR: fail_type_tuple_as_type.carbon:[[@LINE+1]]: only arrays and tuples can be indexed, found T
return x[0];
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/tuple/fail_unexpected_tuple.carbon:[[@LINE+1]]: didn't expect a tuple
// CHECK:STDERR: COMPILATION ERROR: fail_unexpected_tuple.carbon:[[@LINE+1]]: didn't expect a tuple
var a: (auto,) = 1;
return 0;
}