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

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

Issue 23654034: Add code style check error for using static_cast instead of toFoo function. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
Index: Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
index ab53f175ab62f010f666f6647fd8fee0791511c1..61b6f7bb31133e259aaf7346eccc7ae3072372b6 100644
--- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
+++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -764,12 +764,17 @@ class CppStyleTest(CppStyleTestBase):
self.assert_language_rules_check('foo.cpp', statement, error_message)
self.assert_language_rules_check('foo.h', statement, error_message)
- # Test for static_cast readability.
- def test_static_cast_readability(self):
+ # Tests for static_cast readability.
+ def test_use_toFoo_readability(self):
self.assert_lint(
'Text* x = static_cast<Text*>(foo);',
- 'Consider using toText helper function in WebCore/dom/Text.h '
- 'instead of static_cast<Text*>'
+ 'static_cast of class objects is not allowed. Use toText defined in Text.h.'
+ ' [readability/check] [4]')
+
+ def test_create_and_use_toFoo_readability(self):
+ self.assert_lint(
+ 'HTMLButtonElement* x = static_cast<HTMLButtonElement*>(foo);',
+ 'static_cast of class objects is not allowed. Add toHTMLButtonElement in HTMLButtonElement.h and use it instead.'
' [readability/check] [4]')
# We cannot test this functionality because of difference of
« Tools/Scripts/webkitpy/style/checkers/cpp.py ('K') | « 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