mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:01:03 +01:00
Add a newline after diagnostic output when testing (#4818)
This removes some churn when adding new diagnostic cases to test files (where previous to this change the newly added newline would cause the previous diagnostic CHECKs to be updated including changes to the line number because the CHECK for the blank line meant an extra line between CHECK and source line). A few alternatives discussed here: https://discord.com/channels/655572317891461132/655578254970716160/1329573358475673723 --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
a8b46cf561
commit
e6c1f0630a
@@ -30,13 +30,14 @@ extern library fn G();
|
||||
|
||||
// --- fail_identifier.carbon
|
||||
|
||||
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+7]]:16: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault]
|
||||
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+8]]:16: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault]
|
||||
// CHECK:STDERR: extern library foo fn G();
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+3]]:16: error: unrecognized declaration introducer [UnrecognizedDecl]
|
||||
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+4]]:16: error: unrecognized declaration introducer [UnrecognizedDecl]
|
||||
// CHECK:STDERR: extern library foo fn G();
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
extern library foo fn G();
|
||||
|
||||
// CHECK:STDOUT: - filename: extern.carbon
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon
|
||||
|
||||
// CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+3]]:8: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+4]]:8: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: fn foo bar;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
fn foo bar;
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_identifier_instead_of_sig.carbon
|
||||
|
||||
+3
-2
@@ -9,13 +9,14 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon
|
||||
|
||||
// Fix and uncomment this to test error handling.
|
||||
// CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+7]]:7: error: opening symbol without a corresponding closing symbol [UnmatchedOpening]
|
||||
// CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+8]]:7: error: opening symbol without a corresponding closing symbol [UnmatchedOpening]
|
||||
// CHECK:STDERR: fn Div[();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+3]]:7: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+4]]:7: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: fn Div[();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Div[();
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_missing_implicit_close.carbon
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_missing_name.carbon
|
||||
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+3]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn ();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn ();
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_missing_name.carbon
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
|
||||
fn foo
|
||||
|
||||
// CHECK:STDERR: fail_no_sig_or_semi.carbon:[[@LINE+10]]:21: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: fail_no_sig_or_semi.carbon:[[@LINE+11]]:21: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: // CHECK:STDOUT: ]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDOUT: - filename: fail_no_sig_or_semi.carbon
|
||||
// CHECK:STDOUT: parse_tree: [
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon
|
||||
|
||||
// CHECK:STDERR: fail_only_fn_and_semi.carbon:[[@LINE+3]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_only_fn_and_semi.carbon:[[@LINE+4]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn;
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_only_fn_and_semi.carbon
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon
|
||||
|
||||
// CHECK:STDERR: fail_repeated_fn_and_semi.carbon:[[@LINE+3]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_repeated_fn_and_semi.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn fn;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
fn fn;
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_repeated_fn_and_semi.carbon
|
||||
|
||||
Vendored
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon
|
||||
|
||||
// CHECK:STDERR: fail_skip_indented_newline_until_outdent.carbon:[[@LINE+3]]:6: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_skip_indented_newline_until_outdent.carbon:[[@LINE+4]]:6: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn (x,
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn (x,
|
||||
y,
|
||||
z)
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon
|
||||
|
||||
// CHECK:STDERR: fail_skip_indented_newline_with_semi.carbon:[[@LINE+3]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_skip_indented_newline_with_semi.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn (x,
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn (x,
|
||||
y,
|
||||
z);
|
||||
|
||||
Vendored
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon
|
||||
|
||||
// CHECK:STDERR: fail_skip_indented_newline_without_semi.carbon:[[@LINE+3]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_skip_indented_newline_without_semi.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn (x,
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn (x,
|
||||
y,
|
||||
z)
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon
|
||||
|
||||
// CHECK:STDERR: fail_skip_to_newline_without_semi.carbon:[[@LINE+3]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_skip_to_newline_without_semi.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn ()
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn ()
|
||||
fn F();
|
||||
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon
|
||||
|
||||
// CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+3]]:1: error: unrecognized declaration introducer [UnrecognizedDecl]
|
||||
// CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+4]]:1: error: unrecognized declaration introducer [UnrecognizedDecl]
|
||||
// CHECK:STDERR: struct X { fn () }
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
struct X { fn () }
|
||||
fn F();
|
||||
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon
|
||||
|
||||
// CHECK:STDERR: fail_with_identifier_as_param.carbon:[[@LINE+3]]:11: error: expected `:` or `:!` in binding pattern [ExpectedBindingPattern]
|
||||
// CHECK:STDERR: fail_with_identifier_as_param.carbon:[[@LINE+4]]:11: error: expected `:` or `:!` in binding pattern [ExpectedBindingPattern]
|
||||
// CHECK:STDERR: fn foo(bar);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn foo(bar);
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_with_identifier_as_param.carbon
|
||||
|
||||
Vendored
+2
-1
@@ -8,9 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon
|
||||
|
||||
// CHECK:STDERR: fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+3]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z);
|
||||
|
||||
// CHECK:STDOUT: - filename: fail_without_name_and_many_tokens_in_params.carbon
|
||||
|
||||
Reference in New Issue
Block a user