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
@@ -17,5 +17,5 @@
// TODO: We could figure out that this first Failed example is infix
// with one-token lookahead.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_infix_uneven_space_after.carbon:[[@LINE+1]]:16: Expected `;` after expression.
// CHECK:STDERR: fail_infix_uneven_space_after.carbon:[[@LINE+1]]:16: Expected `;` after expression.
var n: i8 = n* n;
@@ -34,10 +34,10 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+1]]:19: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:19: Expected expression.
var a: i32 = n == ;
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+1]]:14: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:14: Expected expression.
var b: i32 = == n;
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+2]]:14: Expected expression.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_invalid_infix.carbon:[[@LINE+1]]:17: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+2]]:14: Expected expression.
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+1]]:17: Expected expression.
var c: i32 = == ;
@@ -20,6 +20,6 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
a and b or c;
}
@@ -20,6 +20,6 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
a or b and c;
}
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_star_minus.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_star_minus.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
var n: i8 = n* -n;
@@ -17,5 +17,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_star_star.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_precedence_star_star.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
var n: i8 = n* *p;
@@ -20,5 +20,5 @@
// before we notice the missing whitespace around the second `*`.
// It'd be better to (somehow) form n*(*p) and reject due to the missing
// whitespace around the first `*`.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_star_star_no_space.carbon:[[@LINE+1]]:16: Expected `;` after expression.
// CHECK:STDERR: fail_star_star_no_space.carbon:[[@LINE+1]]:16: Expected `;` after expression.
var n: i8 = n**p;
+4 -4
View File
@@ -35,9 +35,9 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+4]]:29: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+3]]:34: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+2]]:38: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: toolchain/parser/testdata/operators/fail_variety.carbon:[[@LINE+1]]:40: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+4]]:29: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+3]]:34: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+2]]:38: Parentheses are required to disambiguate operator precedence.
// CHECK:STDERR: fail_variety.carbon:[[@LINE+1]]:40: Parentheses are required to disambiguate operator precedence.
n = a * b + c * d = d * d << e & f - not g;
}
@@ -23,8 +23,8 @@
// CHECK:STDOUT: ]
fn F() {
// CHECK:STDERR: toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+3]]:3: Whitespace is required before this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+2]]:13: Whitespace is required before this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+1]]:23: Whitespace is required before this unary operator.
// CHECK:STDERR: missing_precedence_not.carbon:[[@LINE+3]]:3: Whitespace is required before this unary operator.
// CHECK:STDERR: missing_precedence_not.carbon:[[@LINE+2]]:13: Whitespace is required before this unary operator.
// CHECK:STDERR: missing_precedence_not.carbon:[[@LINE+1]]:23: Whitespace is required before this unary operator.
not a and not b and not c;
}
@@ -16,5 +16,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_infix_uneven_space_before.carbon:[[@LINE+1]]:15: Whitespace missing after binary operator.
// CHECK:STDERR: recover_infix_uneven_space_before.carbon:[[@LINE+1]]:15: Whitespace missing after binary operator.
var n: i8 = n *n;
@@ -15,5 +15,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
var v: type = i8 *;
@@ -20,5 +20,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_before_comma.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space_before_comma.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
var n: i8 = F(i8 *, 0);
@@ -18,5 +18,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_in_call.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space_in_call.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
var n: i8 = F(i8 *);
@@ -15,6 +15,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+2]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is required after this unary operator.
// CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+2]]:18: Whitespace is not allowed before this unary operator.
// CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is required after this unary operator.
var v: type = i8 * ;
@@ -15,6 +15,6 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_prefix_space.carbon:[[@LINE+2]]:13: Whitespace is not allowed after this unary operator.
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_prefix_space.carbon:[[@LINE+1]]:13: Whitespace is required before this unary operator.
// CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+2]]:13: Whitespace is not allowed after this unary operator.
// CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+1]]:13: Whitespace is required before this unary operator.
var n: i8 = - n;
@@ -15,5 +15,5 @@
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
// CHECK:STDOUT: ]
// CHECK:STDERR: toolchain/parser/testdata/operators/recover_prefix_uneven_space_with_assign.carbon:[[@LINE+1]]:12: Whitespace is not allowed after this unary operator.
// CHECK:STDERR: recover_prefix_uneven_space_with_assign.carbon:[[@LINE+1]]:12: Whitespace is not allowed after this unary operator.
var n: i8 =- n;