mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:11:05 +01:00
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:
+1
-1
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Bad {
|
||||
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/interface/fail_bad_member_kind.carbon:[[@LINE+1]]: syntax error, unexpected VAR
|
||||
// CHECK:STDERR: SYNTAX ERROR: fail_bad_member_kind.carbon:[[@LINE+1]]: syntax error, unexpected VAR
|
||||
var V: i32;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Vector {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_extends_not_constraint.carbon:[[@LINE+1]]: expected a constraint in extends declaration, found i32
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_extends_not_constraint.carbon:[[@LINE+1]]: expected a constraint in extends declaration, found i32
|
||||
extends i32;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Point {
|
||||
}
|
||||
|
||||
// Error: need to specify which type implementing `Vector` for.
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_external_impl_omit_self.carbon:[[@LINE+1]]: could not resolve 'Self'
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_external_impl_omit_self.carbon:[[@LINE+1]]: could not resolve 'Self'
|
||||
external impl as Vector {
|
||||
fn Add[self: Point](b: Point) -> Point {
|
||||
return {.x = self.x + b.x, .y = self.y + b.y};
|
||||
|
||||
@@ -16,7 +16,7 @@ class Point {
|
||||
var y: i32;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_external_impl_self.carbon:[[@LINE+1]]: could not resolve 'Self'
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_external_impl_self.carbon:[[@LINE+1]]: could not resolve 'Self'
|
||||
external impl Self as Vector {
|
||||
fn Add[self: Point](b: Point) -> Point {
|
||||
return {.x = self.x + b.x, .y = self.y + b.y};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Vector {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_impl_as_not_constraint.carbon:[[@LINE+1]]: expected a constraint in impl as declaration, found i32
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_impl_as_not_constraint.carbon:[[@LINE+1]]: expected a constraint in impl as declaration, found i32
|
||||
impl Self as i32;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ package ExplorerTest api;
|
||||
interface A {}
|
||||
|
||||
interface B {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_impl_as_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_impl_as_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
|
||||
impl 5 as A;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class Point {
|
||||
}
|
||||
fn Scale[self: Point](v: i32) -> i32 {
|
||||
return 0;
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_impl_bad_member.carbon:[[@LINE+3]]: type error in member of implementation
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_impl_bad_member.carbon:[[@LINE+3]]: type error in member of implementation
|
||||
// CHECK:STDERR: expected: fn (i32,) -> class Point
|
||||
// CHECK:STDERR: actual: fn (i32,) -> i32
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class Point {
|
||||
fn Add[self: Point](b: Point) -> Point {
|
||||
return {.x = self.x + b.x, .y = self.y + b.y};
|
||||
}
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_impl_missing_member.carbon:[[@LINE+1]]: implementation missing Scale
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_impl_missing_member.carbon:[[@LINE+1]]: implementation missing Scale
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ package ExplorerTest api;
|
||||
interface Vector {
|
||||
fn Zero() -> i32;
|
||||
}
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_impl_not_type.carbon:[[@LINE+1]]: type error in type expression: 'String' is not implicitly convertible to 'type'
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_impl_not_type.carbon:[[@LINE+1]]: type error in type expression: 'String' is not implicitly convertible to 'type'
|
||||
impl "hello" as Vector {
|
||||
fn Zero() -> i32 { return 0; }
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ interface Vector {
|
||||
}
|
||||
|
||||
fn ScaleGeneric[T:! Vector](a: T, s: i32) -> T {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_interface_missing_member.carbon:[[@LINE+1]]: member access, Scale not in interface Vector where T impls interface Vector
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_interface_missing_member.carbon:[[@LINE+1]]: member access, Scale not in interface Vector where T impls interface Vector
|
||||
return a.Scale(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Vector {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_member_lookup_in_definition.carbon:[[@LINE+1]]: incomplete type `interface Vector` used in member access
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_member_lookup_in_definition.carbon:[[@LINE+1]]: incomplete type `interface Vector` used in member access
|
||||
fn ScalarZero() -> Vector.ScalarType;
|
||||
let ScalarType:! type;
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ fn AddAndScaleGeneric[T:! Vector](a: T, b: T, s: i32) -> T {
|
||||
fn Main() -> i32 {
|
||||
var a: Point = {.x = 0, .y = 0};
|
||||
var b: Point = {.x = 2, .y = 3};
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_no_impl.carbon:[[@LINE+1]]: could not find implementation of interface Vector for class Point
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_no_impl.carbon:[[@LINE+1]]: could not find implementation of interface Vector for class Point
|
||||
var p: Point = AddAndScaleGeneric(a, b, 3);
|
||||
return p.x - 6;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Vector {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_qualified_method.carbon:[[@LINE+1]]: qualified declaration names are not permitted in this context
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_qualified_method.carbon:[[@LINE+1]]: qualified declaration names are not permitted in this context
|
||||
fn Vector.Zero() -> i32;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface Vector {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_self_lookup_in_definition.carbon:[[@LINE+1]]: incomplete type `interface Vector` used in member access
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_self_lookup_in_definition.carbon:[[@LINE+1]]: incomplete type `interface Vector` used in member access
|
||||
fn ScalarZero() -> Self.ScalarType;
|
||||
let ScalarType:! type;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface IFace {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_use_assoc_const_before_decl.carbon:[[@LINE+1]]: 'C' has not been declared yet
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_use_assoc_const_before_decl.carbon:[[@LINE+1]]: 'C' has not been declared yet
|
||||
let B:! C;
|
||||
let C:! IFace;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package ExplorerTest api;
|
||||
|
||||
interface IFace {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_use_assoc_const_in_defn.carbon:[[@LINE+1]]: 'T' is not usable until after it has been completely declared
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_use_assoc_const_in_defn.carbon:[[@LINE+1]]: 'T' is not usable until after it has been completely declared
|
||||
let T:! T.IFace;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ interface X {
|
||||
fn F() -> type;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/interface/fail_use_symbolic_member.carbon:[[@LINE+1]]: member lookup for F in symbolic witness 0 of witness for T:! X
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_use_symbolic_member.carbon:[[@LINE+1]]: member lookup for F in symbolic witness 0 of witness for T:! X
|
||||
fn G[T:! X]() -> T.F() {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user