mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:14:43 +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
@@ -6,7 +6,7 @@
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_alias_expression.carbon:[[@LINE+1]]: invalid target for alias declaration
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_alias_expression.carbon:[[@LINE+1]]: invalid target for alias declaration
|
||||
alias A = 5;
|
||||
|
||||
fn Main() -> i32 { return 0; }
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ package ExplorerTest api;
|
||||
|
||||
var v: i32;
|
||||
// TODO: This should probably be valid if we allow global variables at all.
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_alias_var.carbon:[[@LINE+1]]: invalid target for alias declaration
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_alias_var.carbon:[[@LINE+1]]: invalid target for alias declaration
|
||||
alias A = v;
|
||||
|
||||
fn Main() -> i32 { return 0; }
|
||||
|
||||
@@ -33,7 +33,7 @@ impl forall [U:! Printable] Vector(U) as Printable {
|
||||
|
||||
fn Main() -> i32 {
|
||||
var v: Vector(String) = {.x = "test"};
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_interface_method_as_class_member.carbon:[[@LINE+1]]: Member access to aliases is not yet supported.
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_interface_method_as_class_member.carbon:[[@LINE+1]]: Member access to aliases is not yet supported.
|
||||
v.PrintIt();
|
||||
return 42;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace N;
|
||||
alias M = N;
|
||||
// TODO: It's unclear whether this should be permitted. If not, we should
|
||||
// produce a better diagnostic.
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_namespace_alias_member.carbon:[[@LINE+1]]: alias M cannot be used as a name qualifier
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_namespace_alias_member.carbon:[[@LINE+1]]: alias M cannot be used as a name qualifier
|
||||
fn M.F() {}
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_self_alias.carbon:[[@LINE+1]]: 'a' is not usable until after it has been completely declared
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_self_alias.carbon:[[@LINE+1]]: 'a' is not usable until after it has been completely declared
|
||||
alias a = a;
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ package ExplorerTest api;
|
||||
fn F() {}
|
||||
alias A = F;
|
||||
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_fn_alias_use.carbon:[[@LINE+1]]: alias A cannot be used as a name qualifier
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_fn_alias_use.carbon:[[@LINE+1]]: alias A cannot be used as a name qualifier
|
||||
fn A.Foo() {}
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
@@ -10,6 +10,6 @@ fn F() {}
|
||||
alias A = F;
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_fn_alias_use_expr.carbon:[[@LINE+1]]: member access, unexpected fn () -> () in A.x
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_fn_alias_use_expr.carbon:[[@LINE+1]]: member access, unexpected fn () -> () in A.x
|
||||
return A.x;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ interface Foo {}
|
||||
alias A = Foo;
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_interface_alias_use.carbon:[[@LINE+1]]: member access, bar not in interface Foo
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_interface_alias_use.carbon:[[@LINE+1]]: member access, bar not in interface Foo
|
||||
return A.bar;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ namespace Foo;
|
||||
alias A = Foo;
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_namepsace_alias_use.carbon:[[@LINE+1]]: expected `.member_name` after name of namespace Foo
|
||||
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_namepsace_alias_use.carbon:[[@LINE+1]]: expected `.member_name` after name of namespace Foo
|
||||
return A;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user