mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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:
@@ -30,6 +30,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/basics/fail_name_lookup.carbon:[[@LINE+1]]:3: Name x not found
|
||||
// CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+1]]:3: Name x not found
|
||||
x;
|
||||
}
|
||||
|
||||
@@ -37,5 +37,5 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var x: i32;
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/designators/fail_unsupported.carbon:[[@LINE+1]]:15: Type `i32` does not support designator expressions.
|
||||
// CHECK:STDERR: fail_unsupported.carbon:[[@LINE+1]]:15: Type `i32` does not support designator expressions.
|
||||
var y: i32 = x.b;
|
||||
|
||||
@@ -129,24 +129,24 @@ fn Run1(a: i32) {}
|
||||
fn Run2(a: i32, b: i32) {}
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE-6]]:1: Callable cannot be used: Received 1 argument(s), but require 0 argument(s).
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-6]]:1: Callable cannot be used: Received 1 argument(s), but require 0 argument(s).
|
||||
Run0(1);
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE-9]]:1: Callable cannot be used: Received 2 argument(s), but require 0 argument(s).
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-9]]:1: Callable cannot be used: Received 2 argument(s), but require 0 argument(s).
|
||||
Run0(0, 1);
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE-12]]:1: Callable cannot be used: Received 0 argument(s), but require 1 argument(s).
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-12]]:1: Callable cannot be used: Received 0 argument(s), but require 1 argument(s).
|
||||
Run1();
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE-15]]:1: Callable cannot be used: Received 2 argument(s), but require 1 argument(s).
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-15]]:1: Callable cannot be used: Received 2 argument(s), but require 1 argument(s).
|
||||
Run1(0, 1);
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE-18]]:1: Callable cannot be used: Received 0 argument(s), but require 2 argument(s).
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-18]]:1: Callable cannot be used: Received 0 argument(s), but require 2 argument(s).
|
||||
Run2();
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_count.carbon:[[@LINE-21]]:1: Callable cannot be used: Received 1 argument(s), but require 2 argument(s).
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-21]]:1: Callable cannot be used: Received 1 argument(s), but require 2 argument(s).
|
||||
Run2(0);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
fn Run(a: i32) {}
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_type.carbon:[[@LINE+2]]:6: No matching callable was found.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_param_type.carbon:[[@LINE-4]]:1: Callable cannot be used: Cannot implicityly convert argument 0 from `f64` to `i32`.
|
||||
// CHECK:STDERR: fail_param_type.carbon:[[@LINE+2]]:6: No matching callable was found.
|
||||
// CHECK:STDERR: fail_param_type.carbon:[[@LINE-4]]:1: Callable cannot be used: Cannot implicityly convert argument 0 from `f64` to `i32`.
|
||||
Run(1.0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,6 +57,6 @@
|
||||
fn Foo() -> f64 { return 1.0; }
|
||||
|
||||
fn Run() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon:[[@LINE+1]]:21: Cannot implicitly convert from `f64` to `i32`.
|
||||
// CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+1]]:21: Cannot implicitly convert from `f64` to `i32`.
|
||||
var x: i32 = Foo();
|
||||
}
|
||||
|
||||
+2
-2
@@ -44,6 +44,6 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon:[[@LINE+2]]:16: Redefining a in the same scope.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon:[[@LINE+1]]:8: Previous definition is here.
|
||||
// CHECK:STDERR: fail_param_name_conflict.carbon:[[@LINE+2]]:16: Redefining a in the same scope.
|
||||
// CHECK:STDERR: fail_param_name_conflict.carbon:[[@LINE+1]]:8: Previous definition is here.
|
||||
fn Bar(a: i32, a: i32) {}
|
||||
|
||||
@@ -42,6 +42,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/operators/fail_type_mismatch.carbon:[[@LINE+1]]:13: Cannot implicitly convert from `i32` to `f64`.
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+1]]:13: Cannot implicitly convert from `i32` to `f64`.
|
||||
return 12 + 3.4;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,6 @@
|
||||
fn Main() -> i32 {
|
||||
// The following line has two mismatches, but after the first, it shouldn't
|
||||
// keep erroring.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon:[[@LINE+1]]:13: Cannot implicitly convert from `i32` to `f64`.
|
||||
// CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+1]]:13: Cannot implicitly convert from `i32` to `f64`.
|
||||
return 12 + 3.4 + 12;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/return/fail_type_mismatch.carbon:[[@LINE+1]]:13: Cannot implicitly convert from `f64` to `i32`.
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+1]]:13: Cannot implicitly convert from `f64` to `i32`.
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/return/fail_value_disallowed.carbon:[[@LINE+2]]:11: No return expression should be provided in this context.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/return/fail_value_disallowed.carbon:[[@LINE-2]]:1: There was no return type provided.
|
||||
// CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE+2]]:11: No return expression should be provided in this context.
|
||||
// CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE-2]]:1: There was no return type provided.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/return/fail_value_missing.carbon:[[@LINE+1]]:9: Must return a i32.
|
||||
// CHECK:STDERR: fail_value_missing.carbon:[[@LINE+1]]:9: Must return a i32.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,5 +40,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_assign_empty.carbon:[[@LINE+1]]:22: Cannot implicitly convert from `{} as Type` to `{.a: i32}`.
|
||||
// CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+1]]:22: Cannot implicitly convert from `{} as Type` to `{.a: i32}`.
|
||||
var x: {.a: i32} = {};
|
||||
|
||||
@@ -49,5 +49,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon:[[@LINE+1]]:21: Cannot implicitly convert from `{.a: i32}` to `{} as Type`.
|
||||
// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+1]]:21: Cannot implicitly convert from `{.a: i32}` to `{} as Type`.
|
||||
var x: {} = {.a = 1};
|
||||
|
||||
@@ -59,5 +59,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon:[[@LINE+1]]:28: Cannot implicitly convert from `{.b: i32}` to `{.a: i32}`.
|
||||
// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+1]]:28: Cannot implicitly convert from `{.b: i32}` to `{.a: i32}`.
|
||||
var x: {.a: i32} = {.b = 1};
|
||||
|
||||
@@ -59,5 +59,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon:[[@LINE+1]]:30: Cannot implicitly convert from `{.b: f64}` to `{.a: i32}`.
|
||||
// CHECK:STDERR: fail_field_type_mismatch.carbon:[[@LINE+1]]:30: Cannot implicitly convert from `{.b: f64}` to `{.a: i32}`.
|
||||
var x: {.a: i32} = {.b = 1.0};
|
||||
|
||||
@@ -67,5 +67,5 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var x: {.a: f64} = {.a = 4.0};
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_member_access_type.carbon:[[@LINE+1]]:15: Type `{.a: f64}` does not have a member `b`.
|
||||
// CHECK:STDERR: fail_member_access_type.carbon:[[@LINE+1]]:15: Type `{.a: f64}` does not have a member `b`.
|
||||
var y: i32 = x.b;
|
||||
|
||||
@@ -67,5 +67,5 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var x: {.a: i32} = {.a = 4};
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_non_member_access.carbon:[[@LINE+1]]:15: Type `{.a: i32}` does not have a member `b`.
|
||||
// CHECK:STDERR: fail_non_member_access.carbon:[[@LINE+1]]:15: Type `{.a: i32}` does not have a member `b`.
|
||||
var y: i32 = x.b;
|
||||
|
||||
@@ -62,5 +62,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_too_few_values.carbon:[[@LINE+1]]:37: Cannot implicitly convert from `{.a: i32}` to `{.a: i32, .b: i32}`.
|
||||
// CHECK:STDERR: fail_too_few_values.carbon:[[@LINE+1]]:37: Cannot implicitly convert from `{.a: i32}` to `{.a: i32, .b: i32}`.
|
||||
var x: {.a: i32, .b: i32} = {.a = 1};
|
||||
|
||||
@@ -49,5 +49,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_type_assign.carbon:[[@LINE+1]]:29: Cannot implicitly convert from `Type` to `{.a: i32}`.
|
||||
// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+1]]:29: Cannot implicitly convert from `Type` to `{.a: i32}`.
|
||||
var x: {.a: i32} = {.a: i32};
|
||||
|
||||
@@ -47,5 +47,5 @@
|
||||
// CHECK:STDOUT: ],
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/struct/fail_value_as_type.carbon:[[@LINE+1]]:15: Cannot implicitly convert from `{.a: i32}` to `Type`.
|
||||
// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+1]]:15: Cannot implicitly convert from `{.a: i32}` to `Type`.
|
||||
var x: {.a = 1};
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
fn Main() {
|
||||
var x: i32 = 0;
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/var/fail_duplicate_decl.carbon:[[@LINE+2]]:7: Redefining x in the same scope.
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/var/fail_duplicate_decl.carbon:[[@LINE-2]]:7: Previous definition is here.
|
||||
// CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+2]]:7: Redefining x in the same scope.
|
||||
// CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE-2]]:7: Previous definition is here.
|
||||
var x: i32 = 0;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon:[[@LINE+1]]:19: Cannot implicitly convert from `f64` to `i32`.
|
||||
// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+1]]:19: Cannot implicitly convert from `f64` to `i32`.
|
||||
var x: i32 = 1.0;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/var/fail_init_with_self.carbon:[[@LINE+1]]:16: Name x not found
|
||||
// CHECK:STDERR: fail_init_with_self.carbon:[[@LINE+1]]:16: Name x not found
|
||||
var x: i32 = x;
|
||||
}
|
||||
|
||||
@@ -47,5 +47,5 @@ fn Main() {
|
||||
var x: i32;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon:[[@LINE+1]]:14: Name x not found
|
||||
// CHECK:STDERR: fail_lookup_outside_scope.carbon:[[@LINE+1]]:14: Name x not found
|
||||
var y: i32 = x;
|
||||
|
||||
@@ -45,6 +45,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: toolchain/semantics/testdata/var/fail_storage_is_literal.carbon:[[@LINE+1]]:10: Cannot implicitly convert from `i32` to `Type`.
|
||||
// CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+1]]:10: Cannot implicitly convert from `i32` to `Type`.
|
||||
var x: 1 = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user