diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-suspicious-missing-comma.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-suspicious-missing-comma.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-suspicious-missing-comma.cpp b/clang-tools-extra/test/clang-tidy/misc-suspicious-missing-comma.cpp new file mode 100644 index 00000000000..7b64fab45e8 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/misc-suspicious-missing-comma.cpp @@ -0,0 +1,34 @@ +// RUN: %check_clang_tidy %s misc-suspicious-missing-comma %t + +const char* Cartoons[] = { + "Bugs Bunny", + "Homer Simpson", + "Mickey Mouse", + "Bart Simpson", + "Charlie Brown" // There is a missing comma here. + "Fred Flintstone", + "Popeye", +}; +// CHECK-MESSAGES: :[[@LINE-4]]:3: warning: suspicious string literal, probably missing a comma [misc-suspicious-missing-comma] + +const wchar_t* Colors[] = { + L"Red", L"Yellow", L"Blue", L"Green", L"Purple", L"Rose", L"White", L"Black" +}; + +// The following array should not trigger any warnings. +const char* HttpCommands[] = { + "GET / HTTP/1.0\r\n" + "\r\n", + + "GET /index.html HTTP/1.0\r\n" + "\r\n", + + "GET /favicon.ico HTTP/1.0\r\n" + "header: dummy" + "\r\n", +}; + +// This array is too small to trigger a warning. +const char* SmallArray[] = { + "a" "b", "c" +}; |