fail_bad_comment_introducers.carbon 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/lex/testdata/fail_bad_comment_introducers.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_bad_comment_introducers.carbon
  10. // CHECK:STDOUT: - filename: fail_bad_comment_introducers.carbon
  11. // CHECK:STDOUT: tokens: [
  12. // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '' },
  13. //
  14. // Comments have to have whitespace after `//` currently.
  15. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:3: ERROR: Whitespace is required after '//'.
  16. // CHECK:STDERR: //abc
  17. // CHECK:STDERR: ^
  18. // CHECK:STDERR:
  19. //abc
  20. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:7: ERROR: Whitespace is required after '//'.
  21. // CHECK:STDERR: //indented
  22. // CHECK:STDERR: ^
  23. // CHECK:STDERR:
  24. //indented
  25. // We only want to diagnose these on the first line of a block of similarly
  26. // indented comments.
  27. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:3: ERROR: Whitespace is required after '//'.
  28. // CHECK:STDERR: //abc
  29. // CHECK:STDERR: ^
  30. // CHECK:STDERR:
  31. //abc
  32. //123
  33. //dce
  34. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:11: ERROR: Whitespace is required after '//'.
  35. // CHECK:STDERR: //indented block
  36. // CHECK:STDERR: ^
  37. // CHECK:STDERR:
  38. //indented block
  39. //indented block
  40. //indented block
  41. //indented block
  42. // As we have specialized code to scan short indented comment blocks, make sure
  43. // the behavior is preserved even for (absurdly) large indents.
  44. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+3]]:83: ERROR: Whitespace is required after '//'.
  45. // CHECK:STDERR: //very indented block
  46. // CHECK:STDERR: ^
  47. //very indented block
  48. //very indented block
  49. //very indented block
  50. //very indented block
  51. // An extra un-indented comment line to anchor the end of the file checks.
  52. // CHECK:STDOUT: { index: 1, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '', has_leading_space: true },
  53. // CHECK:STDOUT: ]