mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Fix test regression from 9883c51578
.
This commit is contained in:
parent
0c1c7f193f
commit
6c8669edb2
|
@ -1972,74 +1972,6 @@ class CpplintTest(CpplintTestBase):
|
||||||
error_collector)
|
error_collector)
|
||||||
self.assertEquals('', error_collector.Results())
|
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
|
# Brace usage
|
||||||
def testBraces(self):
|
def testBraces(self):
|
||||||
# Braces shouldn't be followed by a ; unless they're defining a struct
|
# Braces shouldn't be followed by a ; unless they're defining a struct
|
||||||
|
|
Loading…
Reference in New Issue
Block a user