fail_bad_comment_introducers.carbon 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. //
  11. // Comments have to have whitespace after `//` currently.
  12. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
  13. // CHECK:STDERR: //abc
  14. // CHECK:STDERR: ^
  15. // CHECK:STDERR:
  16. //abc
  17. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:7: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
  18. // CHECK:STDERR: //indented
  19. // CHECK:STDERR: ^
  20. // CHECK:STDERR:
  21. //indented
  22. // We only want to diagnose these on the first line of a block of similarly
  23. // indented comments.
  24. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
  25. // CHECK:STDERR: //abc
  26. // CHECK:STDERR: ^
  27. // CHECK:STDERR:
  28. //abc
  29. //123
  30. //dce
  31. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:11: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
  32. // CHECK:STDERR: //indented block
  33. // CHECK:STDERR: ^
  34. // CHECK:STDERR:
  35. //indented block
  36. //indented block
  37. //indented block
  38. //indented block
  39. // As we have specialized code to scan short indented comment blocks, make sure
  40. // the behavior is preserved even for (absurdly) large indents.
  41. // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+4]]:83: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
  42. // CHECK:STDERR: //very indented block
  43. // CHECK:STDERR: ^
  44. // CHECK:STDERR:
  45. //very indented block
  46. //very indented block
  47. //very indented block
  48. //very indented block
  49. // An extra un-indented comment line to anchor the end of the file checks.
  50. // CHECK:STDOUT: - filename: fail_bad_comment_introducers.carbon
  51. // CHECK:STDOUT: tokens: