summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-18 15:53:33 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-18 15:53:33 +0200
commit6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (patch)
treed9c68d1cca0b3e352f1e438561f3e504e641a08f /Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
parentd0424a769059c84ae20beb3c217812792ea6726b (diff)
downloadqtwebkit-6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2.tar.gz
Imported WebKit commit c7503cef7ecb236730d1309676ab9fc723fd061d (http://svn.webkit.org/repository/webkit/trunk@128886)
New snapshot with various build fixes
Diffstat (limited to 'Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py')
-rw-r--r--Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
index adc5c078b..a1b91f292 100644
--- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
+++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -2086,13 +2086,13 @@ class CppStyleTest(CppStyleTestBase):
# Here is an example where the linter gets confused, even though
# the code doesn't violate the style guide.
self.assert_multi_line_lint(
- '''class Foo
- #ifdef DERIVE_FROM_GOO
- : public Goo {
- #else
- : public Hoo {
- #endif
- };''',
+ 'class Foo\n'
+ '#ifdef DERIVE_FROM_GOO\n'
+ ' : public Goo {\n'
+ '#else\n'
+ ' : public Hoo {\n'
+ '#endif\n'
+ '};',
'Failed to find complete declaration of class Foo'
' [build/class] [5]')
@@ -3821,7 +3821,7 @@ class WebKitStyleTest(CppStyleTestBase):
'More than one command on the same line [whitespace/newline] [4]')
# Ignore preprocessor if's.
self.assert_multi_line_lint(
- ' #if (condition) || (condition2)\n',
+ '#if (condition) || (condition2)\n',
'')
# 2. An else statement should go on the same line as a preceding
@@ -3861,6 +3861,9 @@ class WebKitStyleTest(CppStyleTestBase):
# '#define TEST_ASSERT(expression) do { if (!(expression)) { TestsController::shared().testFailed(__FILE__, __LINE__, #expression); return; } } while (0 )\n',
# 'Mismatching spaces inside () in if [whitespace/parens] [5]')
self.assert_multi_line_lint(
+ 'WTF_MAKE_NONCOPYABLE(ClassName); WTF_MAKE_FAST_ALLOCATED;\n',
+ '')
+ self.assert_multi_line_lint(
'if (condition) {\n'
' doSomething();\n'
' doSomethingAgain();\n'
@@ -4388,6 +4391,12 @@ class WebKitStyleTest(CppStyleTestBase):
'if (UNLIKELY(foo == NULL))',
'Use 0 instead of NULL. [readability/null] [5]')
+ def test_directive_indentation(self):
+ self.assert_lint(
+ " #if FOO",
+ "preprocessor directives (e.g., #ifdef, #define, #import) should never be indented."
+ " [whitespace/indent] [4]",
+ "foo.cpp")
def test_using_std(self):
self.assert_lint(