fail_missing_cond.carbon 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/for/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/for/fail_missing_cond.carbon
  10. fn F() {
  11. // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+8]]:7: error: expected `(` after `for` [ExpectedParenAfter]
  12. // CHECK:STDERR: for {
  13. // CHECK:STDERR: ^
  14. // CHECK:STDERR:
  15. // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+4]]:7: error: expected `var` declaration [ExpectedVariableDecl]
  16. // CHECK:STDERR: for {
  17. // CHECK:STDERR: ^
  18. // CHECK:STDERR:
  19. for {
  20. }
  21. // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+8]]:1: error: expected braced code block [ExpectedCodeBlock]
  22. // CHECK:STDERR: }
  23. // CHECK:STDERR: ^
  24. // CHECK:STDERR:
  25. // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+4]]:1: error: expected expression [ExpectedExpr]
  26. // CHECK:STDERR: }
  27. // CHECK:STDERR: ^
  28. // CHECK:STDERR:
  29. }
  30. // CHECK:STDOUT: - filename: fail_missing_cond.carbon
  31. // CHECK:STDOUT: parse_tree: [
  32. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  33. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  34. // CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'F'},
  35. // CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
  36. // CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
  37. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  38. // CHECK:STDOUT: {kind: 'ForHeaderStart', text: 'for', has_error: yes},
  39. // CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
  40. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
  41. // CHECK:STDOUT: {kind: 'ForHeader', text: 'for', has_error: yes, subtree_size: 4},
  42. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: '}', has_error: yes},
  43. // CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
  44. // CHECK:STDOUT: {kind: 'ExprStatement', text: '}', has_error: yes, subtree_size: 2},
  45. // CHECK:STDOUT: {kind: 'CodeBlock', text: '}', has_error: yes, subtree_size: 4},
  46. // CHECK:STDOUT: {kind: 'ForStatement', text: 'for', subtree_size: 9},
  47. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 15},
  48. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  49. // CHECK:STDOUT: ]