mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 17:21:04 +01:00
Unify lit.cfg.py approach (#2249)
On #2224 @zygoloid pointed out we needed --implicit-check-not to ensure we were correctly matching output. This is the standard way we're writing explorer tests, so I was looking at unifying our lit approaches. This is one take on it, making more use of substitutions to bring various testing into alignment, as well as symlinks to avoid config skew (maybe I'll eventually figure out a better solution than symlinks). Makes a couple small fixes in explorer to remove end-of-line whitespace on output.
This commit is contained in:
+3
-5
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: -2
|
||||
// CHECK:result: -2
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 0
|
||||
// CHECK:result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-5
@@ -2,10 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -13,7 +11,7 @@ package ExplorerTest api;
|
||||
fn Bad[T:! Type](x: {.a: i32, .b: T}) {}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T:! Type}`
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T:! Type}`
|
||||
Bad({.b = 5, .a = 7, .c = 2});
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-5
@@ -2,10 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -13,7 +11,7 @@ package ExplorerTest api;
|
||||
fn Bad[T:! Type](x: {.a: i32, .b: T}) {}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}`
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}`
|
||||
Bad({.a = 5});
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK: SYNTAX ERROR: {{.*}}/explorer/testdata/generic_function/fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
|
||||
// CHECK:SYNTAX ERROR: {{.*}}/explorer/testdata/generic_function/fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
|
||||
fn F[T: Type]();
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
fn id[T:! Type](x: T) -> T {
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
|
||||
// CHECK: could not find implementation of interface AddWith(U = i32) for T:! Type
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
|
||||
// CHECK:could not find implementation of interface AddWith(U = i32) for T:! Type
|
||||
return x + 0;
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -2,15 +2,13 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: Expected a type, but got 42
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: Expected a type, but got 42
|
||||
fn F[a:! 42]();
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -15,8 +13,8 @@ fn fst[T:! Type](x: T, y: T) -> T {
|
||||
}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type:
|
||||
// CHECK: i32
|
||||
// CHECK: bool
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type:
|
||||
// CHECK: i32
|
||||
// CHECK: bool
|
||||
return fst(0, true);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -15,7 +13,7 @@ fn id[T:! Type](x: i32) -> i32 {
|
||||
}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_unused.carbon:[[@LINE+2]]: could not deduce type argument for type parameter T
|
||||
// CHECK: in id(0)
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_unused.carbon:[[@LINE+2]]: could not deduce type argument for type parameter T
|
||||
// CHECK:in id(0)
|
||||
return id(0);
|
||||
}
|
||||
|
||||
+3
-5
@@ -2,10 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package Foo api;
|
||||
@@ -17,7 +15,7 @@ fn Get[T:! ()](n: T) -> i32 { return 2; }
|
||||
|
||||
fn Main() -> i32 {
|
||||
var x : X = {};
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
|
||||
Get(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 0
|
||||
// CHECK:result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 4213
|
||||
// CHECK:result: 4213
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 1
|
||||
// CHECK:result: 1
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 1
|
||||
// CHECK:result: 1
|
||||
|
||||
package ExplorerTest api;
|
||||
class A(T:! Type) {
|
||||
|
||||
+3
-5
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 0
|
||||
// CHECK:result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-5
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 0
|
||||
// CHECK:result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-5
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 1
|
||||
// CHECK:result: 1
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-5
@@ -2,12 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 0
|
||||
// CHECK:result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user