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
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_alternative_not_type.carbon:[[@LINE+1]]: type error in type expression: '(i32,)' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_alternative_not_type.carbon:[[@LINE+1]]: type error in type expression: '(i32,)' is not implicitly convertible to 'type'
choice C { X(42) }
fn Main() -> i32 {
@@ -7,7 +7,7 @@
package ExplorerTest api;
choice Ch {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_alternative_uses_choice.carbon:[[@LINE+1]]: 'Ch' is not usable until after it has been completely declared
// CHECK:STDERR: COMPILATION ERROR: fail_alternative_uses_choice.carbon:[[@LINE+1]]: 'Ch' is not usable until after it has been completely declared
Opt(Ch)
}
@@ -10,7 +10,7 @@ fn F() {}
fn G() {}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_assign_to_function.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `F`
// CHECK:STDERR: COMPILATION ERROR: fail_assign_to_function.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `F`
F = G;
return 0;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_assign_to_rval.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `1`
// CHECK:STDERR: COMPILATION ERROR: fail_assign_to_rval.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `1`
1 = 0;
return 0;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
{
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_block.carbon:[[@LINE+1]]: syntax error, unexpected RETURN, expecting PERIOD or RIGHT_CURLY_BRACE
// CHECK:STDERR: SYNTAX ERROR: fail_block.carbon:[[@LINE+1]]: syntax error, unexpected RETURN, expecting PERIOD or RIGHT_CURLY_BRACE
return 0;
}
}
@@ -13,7 +13,7 @@ choice Ints {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
// CHECK:STDERR: COMPILATION ERROR: fail_choice_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
match (Ints.None()) {
case Ints.None => { return 0; }
default => { return 1; }
@@ -15,7 +15,7 @@ choice Ints {
fn Main() -> i32 {
match (Ints.None) {
case Ints.None() => { return 0; }
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: COMPILATION ERROR: fail_choice_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: expected: choice Ints
// CHECK:STDERR: actual: fn () -> choice Ints
default => { return 1; }
@@ -14,7 +14,7 @@ choice Ints {
fn Main() -> i32 {
match (Ints.None) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_pattern_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
// CHECK:STDERR: COMPILATION ERROR: fail_choice_pattern_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
case Ints.None() => { return 0; }
default => { return 1; }
}
@@ -15,7 +15,7 @@ choice Ints {
fn Main() -> i32 {
match (Ints.None()) {
case Ints.None => { return 0; }
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_pattern_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: COMPILATION ERROR: fail_choice_pattern_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: expected: fn () -> choice Ints
// CHECK:STDERR: actual: choice Ints
default => { return 1; }
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn CompareBools(a: bool, b: bool) -> bool {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_compare_precedence.carbon:[[@LINE+1]]: syntax error, unexpected EQUAL_EQUAL, expecting SEMICOLON
// CHECK:STDERR: SYNTAX ERROR: fail_compare_precedence.carbon:[[@LINE+1]]: syntax error, unexpected EQUAL_EQUAL, expecting SEMICOLON
return not a == b;
}
+1 -1
View File
@@ -4,5 +4,5 @@
//
// AUTOUPDATE
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_invalid_char.carbon:[[@LINE+1]]: invalid character '\xEF' in source file.
// CHECK:STDERR: SYNTAX ERROR: fail_invalid_char.carbon:[[@LINE+1]]: invalid character '\xEF' in source file.
�
+1 -1
View File
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_invalid_integer.carbon:[[@LINE+1]]: Invalid integer literal: 11111111111111111111111111
// CHECK:STDERR: SYNTAX ERROR: fail_invalid_integer.carbon:[[@LINE+1]]: Invalid integer literal: 11111111111111111111111111
return 11111111111111111111111111;
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_invalid_integer_type.carbon:[[@LINE+1]]: Invalid type literal: i11111111111111111111111111
// CHECK:STDERR: SYNTAX ERROR: fail_invalid_integer_type.carbon:[[@LINE+1]]: Invalid type literal: i11111111111111111111111111
var x: i11111111111111111111111111 = 1;
return 0;
}
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_unimplemented_example.carbon:[[@LINE+1]]: Unimplemented
// CHECK:STDERR: COMPILATION ERROR: fail_unimplemented_example.carbon:[[@LINE+1]]: Unimplemented
return 1 __unimplemented_example_infix 2;
}
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_unknown_intrinsic.carbon:[[@LINE+1]]: Unknown intrinsic 'nonexistent'
// CHECK:STDERR: SYNTAX ERROR: fail_unknown_intrinsic.carbon:[[@LINE+1]]: Unknown intrinsic 'nonexistent'
return __intrinsic_nonexistent();
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_unsupported_integer_type.carbon:[[@LINE+1]]: Only i32 is supported for now: i64
// CHECK:STDERR: SYNTAX ERROR: fail_unsupported_integer_type.carbon:[[@LINE+1]]: Only i32 is supported for now: i64
var x: i64 = 1;
return 0;
}