mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 20:31:10 +01:00
This has is a nice-to-have for me. Frequently I want to run a specific test, and end up digging through output to be able to copy-paste the run line. This uses TIP lines to inject the command into the file when using AUTOUPDATE. Note, one of the reasons I want this is because "bazel test //toolchain/testing:file_test --test_output=all" has been regularly exceeding bazel's output limit for me (workaround is either opening the output file or specifying an obscure output limit flag), making it a little harder for me to get the commands. However, frequently I'm adding a file and want to iterate on it, so that's really the use case I have in mind here.
102 lines
4.3 KiB
Plaintext
102 lines
4.3 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/library/fail_invalid_name.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/library/fail_invalid_name.carbon
|
|
|
|
// --- fail_identifier.carbon
|
|
|
|
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+4]]:9: ERROR: Expected `default` or a string literal to specify the library name.
|
|
// CHECK:STDERR: library Shapes;
|
|
// CHECK:STDERR: ^~~~~~
|
|
// CHECK:STDERR:
|
|
library Shapes;
|
|
|
|
// --- fail_raw_identifier.carbon
|
|
|
|
// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+4]]:9: ERROR: Expected `default` or a string literal to specify the library name.
|
|
// CHECK:STDERR: library r#default;
|
|
// CHECK:STDERR: ^~~~~~~
|
|
// CHECK:STDERR:
|
|
library r#default;
|
|
|
|
// --- fail_missing.carbon
|
|
|
|
// CHECK:STDERR: fail_missing.carbon:[[@LINE+4]]:8: ERROR: Expected `default` or a string literal to specify the library name.
|
|
// CHECK:STDERR: library;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
library;
|
|
|
|
// --- fail_missing_with_api.carbon
|
|
|
|
// CHECK:STDERR: fail_missing_with_api.carbon:[[@LINE+4]]:8: ERROR: Expected `default` or a string literal to specify the library name.
|
|
// CHECK:STDERR: library;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
library;
|
|
|
|
// --- fail_trailing_impl.carbon
|
|
|
|
// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+4]]:25: ERROR: `library` declarations must end with a `;`.
|
|
// CHECK:STDERR: library "trailing_impl" impl
|
|
// CHECK:STDERR: ^~~~
|
|
// CHECK:STDERR:
|
|
library "trailing_impl" impl
|
|
|
|
// --- fail_no_semi.carbon
|
|
|
|
library "NoSemi"
|
|
|
|
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+46]]:21: ERROR: `library` declarations must end with a `;`.
|
|
// CHECK:STDERR: // CHECK:STDOUT: ]
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDOUT: - filename: fail_identifier.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
|
// CHECK:STDOUT: {kind: 'LibraryDecl', text: ';', has_error: yes, subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|
|
// CHECK:STDOUT: - filename: fail_raw_identifier.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
|
// CHECK:STDOUT: {kind: 'LibraryDecl', text: ';', has_error: yes, subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|
|
// CHECK:STDOUT: - filename: fail_missing.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
|
// CHECK:STDOUT: {kind: 'LibraryDecl', text: ';', has_error: yes, subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|
|
// CHECK:STDOUT: - filename: fail_missing_with_api.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
|
// CHECK:STDOUT: {kind: 'LibraryDecl', text: ';', has_error: yes, subtree_size: 2},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|
|
// CHECK:STDOUT: - filename: fail_trailing_impl.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
|
// CHECK:STDOUT: {kind: 'LibraryName', text: '"trailing_impl"'},
|
|
// CHECK:STDOUT: {kind: 'LibraryDecl', text: 'impl', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|
|
// CHECK:STDOUT: - filename: fail_no_semi.carbon
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
|
// CHECK:STDOUT: {kind: 'LibraryName', text: '"NoSemi"'},
|
|
// CHECK:STDOUT: {kind: 'LibraryDecl', text: '"NoSemi"', has_error: yes, subtree_size: 3},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|