Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

Issue 2800883004: Port cpplint's C++11 raw string support to blink's cpp style checker. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
index 380242c4b4824d2728c87a40082a0b0b265477ca..635c47d009fc4f1513ceb73f4ae09d03ecca983b 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -1092,6 +1092,51 @@ class CppStyleTest(CppStyleTestBase):
self.assertEqual('f(a, b);',
cpp_style.cleanse_comments('f(a, /* name */b);'))
+ def test_raw_strings(self):
+ self.assert_multi_line_lint(
+ '''
+ void Func() {
+ static const char kString[] = R"(
+ #endif <- invalid preprocessor should be ignored
+ */ <- invalid comment should be ignored too
+ )";
+ }''',
+ '')
+ self.assert_multi_line_lint(
+ '''
+ void Func() {
+ const char s[] = R"TrueDelimiter(
+ )"
+ )FalseDelimiter"
+ )TrueDelimiter";
+ }''',
+ '')
+ self.assert_multi_line_lint(
+ '''
+ void Func() {
+ char char kString[] = R"( ";" )";
+ }''',
+ '')
+ self.assert_multi_line_lint(
+ '''
+ static const char kRawString[] = R"(
+ \tstatic const int kLineWithTab = 1;
+ static const int kLineWithTrailingWhiteSpace = 1;\x20
+
+ void WeirdNumberOfSpacesAtLineStart() {
+ string x;
+ x += StrCat("Use StrAppend instead");
+ }
+
+ void BlankLineAtEndOfBlock() {
+ // TODO incorrectly formatted
+ //Badly formatted comment
+
+ }
+
+ )";''',
+ '')
+
def test_multi_line_comments(self):
# missing explicit is bad
self.assert_multi_line_lint(
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698