check-webkit-style complains about WEBKIT_EXPORT in test/WebUnitTests.h
authorlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2011 19:02:21 +0000 (19:02 +0000)
committerlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2011 19:02:21 +0000 (19:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70747

Reviewed by Tony Chang.

* Scripts/webkitpy/style/checkers/cpp.py: Allow WEBKIT_EXPORT in tests dir.
* Scripts/webkitpy/style/checkers/cpp_unittest.py: Corresponding test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98264 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/cpp.py
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

index 5b973da..d66cff9 100644 (file)
@@ -1,3 +1,13 @@
+2011-10-24  David Levin  <levin@chromium.org>
+
+        check-webkit-style complains about WEBKIT_EXPORT in test/WebUnitTests.h
+        https://bugs.webkit.org/show_bug.cgi?id=70747
+
+        Reviewed by Tony Chang.
+
+        * Scripts/webkitpy/style/checkers/cpp.py: Allow WEBKIT_EXPORT in tests dir.
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py: Corresponding test.
+
 2011-10-24  Balazs Kelemen  <kbalazs@webkit.org>
 
         [Qt][WK2] Crash when running pixel tests
index 54b15d1..0461ac5 100644 (file)
@@ -1602,9 +1602,9 @@ def check_function_definition(filename, file_extension, clean_lines, line_number
 
     modifiers_and_return_type = function_state.modifiers_and_return_type()
     if filename.find('/chromium/') != -1 and search(r'\bWEBKIT_EXPORT\b', modifiers_and_return_type):
-        if filename.find('/chromium/public/') == -1:
+        if filename.find('/chromium/public/') == -1 and filename.find('/chromium/tests/') == -1:
             error(function_state.function_name_start_position.row, 'readability/webkit_export', 5,
-                  'WEBKIT_EXPORT should only appear in the chromium public directory.')
+                  'WEBKIT_EXPORT should only appear in the chromium public (or tests) directory.')
         elif not file_extension == "h":
             error(function_state.function_name_start_position.row, 'readability/webkit_export', 5,
                   'WEBKIT_EXPORT should only be used in header files.')
index 130588e..1ce2c5a 100644 (file)
@@ -4524,11 +4524,15 @@ class WebKitStyleTest(CppStyleTestBase):
                           self.perform_lint('WEBKIT_EXPORT int foo();\n',
                                             'WebKit/chromium/public/test.h',
                                             webkit_export_error_rules))
+        self.assertEquals('',
+                          self.perform_lint('WEBKIT_EXPORT int foo();\n',
+                                            'WebKit/chromium/tests/test.h',
+                                            webkit_export_error_rules))
         self.assertEquals('WEBKIT_EXPORT should only be used in header files.  [readability/webkit_export] [5]',
                           self.perform_lint('WEBKIT_EXPORT int foo();\n',
                                             'WebKit/chromium/public/test.cpp',
                                             webkit_export_error_rules))
-        self.assertEquals('WEBKIT_EXPORT should only appear in the chromium public directory.  [readability/webkit_export] [5]',
+        self.assertEquals('WEBKIT_EXPORT should only appear in the chromium public (or tests) directory.  [readability/webkit_export] [5]',
                           self.perform_lint('WEBKIT_EXPORT int foo();\n',
                                             'WebKit/chromium/src/test.h',
                                             webkit_export_error_rules))