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
@@ -8,7 +8,7 @@ package ExplorerTest api;
class Point(T:! type) {
// Point(T, T) does not match class declaration
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_args_mismatch.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2
// CHECK:STDERR: COMPILATION ERROR: fail_args_mismatch.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2
fn Origin(zero: T) -> Point(T, T) {
return {.x = zero, .y = zero};
}
@@ -18,7 +18,7 @@ fn FirstOfTwoPoints[T:! type](a: Point(T), b: Point(T)) -> Point(T) {
fn Main() -> i32 {
var p: Point(i32) = {.x = 0, .y = 1};
var q: Point(bool) = {.x = true, .y = false};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_argument_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
// CHECK:STDERR: COMPILATION ERROR: fail_argument_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
// CHECK:STDERR: i32
// CHECK:STDERR: bool
return FirstOfTwoPoints(p, q).x;
@@ -7,7 +7,7 @@
package ExplorerTest api;
class Point(T:! i32) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_bad_parameter_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_bad_parameter_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'type'
fn Origin(zero: T) -> Point(T) {
return {.x = zero, .y = zero};
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn BadSimpleMemberAccess[T:! type](a: T) -> T {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_field_access_on_generic.carbon:[[@LINE+1]]: member access in unconstrained type
// CHECK:STDERR: COMPILATION ERROR: fail_field_access_on_generic.carbon:[[@LINE+1]]: member access in unconstrained type
return a.x;
}
@@ -16,7 +16,7 @@ class Point(T:! type) {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_generic_class_arg.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2
// CHECK:STDERR: COMPILATION ERROR: fail_generic_class_arg.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2
var p: Point(i32) = Point(i32, i32).Create(0, 1);
return p.x;
}
@@ -9,7 +9,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var t: auto = 5;
match (t) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_generic_in_pattern.carbon:[[@LINE+1]]: generic binding may not occur in pattern with expected type T:! i32
// CHECK:STDERR: COMPILATION ERROR: fail_generic_in_pattern.carbon:[[@LINE+1]]: generic binding may not occur in pattern with expected type T:! i32
case T:! i32 => { return 0; }
default => { return 1; }
}
@@ -15,7 +15,7 @@ class Point {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_instantiate_non_generic.carbon:[[@LINE+1]]: in call `Point(i32)`, expected callee to be a function, found `type`
// CHECK:STDERR: COMPILATION ERROR: fail_instantiate_non_generic.carbon:[[@LINE+1]]: in call `Point(i32)`, expected callee to be a function, found `type`
var p: Point(i32) = Point.Origin();
return 0;
}
+1 -1
View File
@@ -12,7 +12,7 @@ class Point(T:! type) {
}
// Error: wrote `Point` instead of `Point(T)`, `Point` by itself is not a type.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_no_args.carbon:[[@LINE+1]]: 'Point' must be given an argument list
// CHECK:STDERR: COMPILATION ERROR: fail_no_args.carbon:[[@LINE+1]]: 'Point' must be given an argument list
fn GetX[self: Point]() -> T {
return self.x;
}
+1 -1
View File
@@ -13,7 +13,7 @@ class Point(T:! type) {
fn Main() -> i32 {
var p: Point(i32) = {.x = 0, .y = 0};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_point_equal.carbon:[[@LINE+1]]: type error in initializer of variable: 'class Point(T = i32)' is not implicitly convertible to 'class Point(T = bool)'
// CHECK:STDERR: COMPILATION ERROR: fail_point_equal.carbon:[[@LINE+1]]: type error in initializer of variable: 'class Point(T = i32)' is not implicitly convertible to 'class Point(T = bool)'
var q: Point(bool) = p;
return 0;
}
@@ -8,7 +8,7 @@ package ExplorerTest api;
class Point(T:! type) {
// The return type should be Point(T). Point by itself is not a type.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_return_type_is_type.carbon:[[@LINE+1]]: 'Point' must be given an argument list
// CHECK:STDERR: COMPILATION ERROR: fail_return_type_is_type.carbon:[[@LINE+1]]: 'Point' must be given an argument list
fn Create(x: T, y: T) -> Point {
return {.x = x, .y = y};
}
+1 -1
View File
@@ -9,7 +9,7 @@ package ExplorerTest api;
class Point(T:! type) {
// Error: wrote `Self(T)` instead of `Self`.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_self_with_arg.carbon:[[@LINE+1]]: in call `Self(T)`, expected callee to be a function, found `type`
// CHECK:STDERR: COMPILATION ERROR: fail_self_with_arg.carbon:[[@LINE+1]]: in call `Self(T)`, expected callee to be a function, found `type`
fn Origin(zero: T) -> Self(T) {
return {.x = zero, .y = zero};
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
class Point(T:! type) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_two_arg_lists.carbon:[[@LINE+1]]: in call `Point(T)(T)`, expected callee to be a function, found `type`
// CHECK:STDERR: COMPILATION ERROR: fail_two_arg_lists.carbon:[[@LINE+1]]: in call `Point(T)(T)`, expected callee to be a function, found `type`
fn Origin(zero: T) -> Point(T)(T) {
return {.x = zero, .y = zero};
}
@@ -12,7 +12,7 @@ fn F(x: HasI32Param(1)) {}
fn Main() -> i32 {
var n: HasI32Param(0) = {};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/generic_class/fail_value_param_mismatch.carbon:[[@LINE+1]]: mismatch in non-deduced values, `0` != `1`
// CHECK:STDERR: COMPILATION ERROR: fail_value_param_mismatch.carbon:[[@LINE+1]]: mismatch in non-deduced values, `0` != `1`
F(n);
return 0;
}