diff --git a/cpplint/cpplint_unittest.py b/cpplint/cpplint_unittest.py index 308626910..4931523cd 100755 --- a/cpplint/cpplint_unittest.py +++ b/cpplint/cpplint_unittest.py @@ -1972,74 +1972,6 @@ def testDisallowMacrosAtEnd(self): error_collector) self.assertEquals('', error_collector.Results()) - # DISALLOW* macros should be in the private: section. - def testMisplacedDisallowMacros(self): - for macro_name in ( - 'DISALLOW_COPY_AND_ASSIGN', - 'DISALLOW_IMPLICIT_CONSTRUCTORS'): - self.TestMultiLineLint( - """ - class A {' - public: - %s(A); - };""" % macro_name, - ('%s must be in the private: section' % macro_name) + - ' [readability/constructors] [3]') - - self.TestMultiLineLint( - """ - struct B {' - %s(B); - };""" % macro_name, - ('%s must be in the private: section' % macro_name) + - ' [readability/constructors] [3]') - - self.TestMultiLineLint( - """ - class Outer1 {' - private: - struct Inner1 { - %s(Inner1); - }; - %s(Outer1); - };""" % (macro_name, macro_name), - ('%s must be in the private: section' % macro_name) + - ' [readability/constructors] [3]') - - self.TestMultiLineLint( - """ - class Outer2 {' - private: - class Inner2 { - %s(Inner2); - }; - %s(Outer2); - };""" % (macro_name, macro_name), - '') - # Extra checks to make sure that nested classes are handled - # correctly. Use different macros for inner and outer classes so - # that we can tell the error messages apart. - self.TestMultiLineLint( - """ - class Outer3 { - struct Inner3 { - DISALLOW_COPY_AND_ASSIGN(Inner3); - }; - DISALLOW_IMPLICIT_CONSTRUCTORS(Outer3); - };""", - ('DISALLOW_COPY_AND_ASSIGN must be in the private: section' - ' [readability/constructors] [3]')) - self.TestMultiLineLint( - """ - struct Outer4 { - class Inner4 { - DISALLOW_COPY_AND_ASSIGN(Inner4); - }; - DISALLOW_IMPLICIT_CONSTRUCTORS(Outer4); - };""", - ('DISALLOW_IMPLICIT_CONSTRUCTORS must be in the private: section' - ' [readability/constructors] [3]')) - # Brace usage def testBraces(self): # Braces shouldn't be followed by a ; unless they're defining a struct