fail_missing_cond.carbon 1.9 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/while/fail_missing_cond.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/fail_missing_cond.carbon
  10. fn F() {
  11. // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+4]]:9: error: expected `(` after `while` [ExpectedParenAfter]
  12. // CHECK:STDERR: while {
  13. // CHECK:STDERR: ^
  14. // CHECK:STDERR:
  15. while {
  16. }
  17. }
  18. // CHECK:STDOUT: - filename: fail_missing_cond.carbon
  19. // CHECK:STDOUT: parse_tree: [
  20. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  21. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  22. // CHECK:STDOUT: {kind: 'IdentifierNameMaybeBeforeSignature', text: 'F'},
  23. // CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('},
  24. // CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 2},
  25. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  26. // CHECK:STDOUT: {kind: 'WhileConditionStart', text: 'while', has_error: yes},
  27. // CHECK:STDOUT: {kind: 'InvalidParse', text: '{', has_error: yes},
  28. // CHECK:STDOUT: {kind: 'WhileCondition', text: 'while', has_error: yes, subtree_size: 3},
  29. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: '{'},
  30. // CHECK:STDOUT: {kind: 'CodeBlock', text: '}', subtree_size: 2},
  31. // CHECK:STDOUT: {kind: 'WhileStatement', text: 'while', subtree_size: 6},
  32. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 12},
  33. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  34. // CHECK:STDOUT: ]