fail_bad_comment_introducers.carbon 2.7 KB

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