MCPcopy Index your code
hub / github.com/cpplint/cpplint / testDisallowMacrosAtEnd

Method testDisallowMacrosAtEnd

cpplint_unittest.py:2338–2421  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2336 # DISALLOW_COPY_AND_ASSIGN and DISALLOW_IMPLICIT_CONSTRUCTORS should be at
2337 # end of class if present.
2338 def testDisallowMacrosAtEnd(self):
2339 for macro_name in ("DISALLOW_COPY_AND_ASSIGN", "DISALLOW_IMPLICIT_CONSTRUCTORS"):
2340 error_collector = ErrorCollector(self.assertTrue)
2341 cpplint.ProcessFileData(
2342 "foo.cc",
2343 "cc",
2344 [
2345 "// Copyright 2014 Your Company.",
2346 "class SomeClass {",
2347 " private:",
2348 " %s(SomeClass);" % macro_name,
2349 " int member_;",
2350 "};",
2351 "",
2352 ],
2353 error_collector,
2354 )
2355 assert (
2356 "%s should be the last thing in the class" % macro_name
2357 + " [readability/constructors] [3]"
2358 == error_collector.Results()
2359 )
2360
2361 error_collector = ErrorCollector(self.assertTrue)
2362 cpplint.ProcessFileData(
2363 "foo.cc",
2364 "cc",
2365 [
2366 "// Copyright 2014 Your Company.",
2367 "class OuterClass {",
2368 " private:",
2369 " struct InnerClass {",
2370 " private:",
2371 " %s(InnerClass);" % macro_name,
2372 " int member;",
2373 " };",
2374 "};",
2375 "",
2376 ],
2377 error_collector,
2378 )
2379 assert (
2380 "%s should be the last thing in the class" % macro_name
2381 + " [readability/constructors] [3]"
2382 == error_collector.Results()
2383 )
2384
2385 error_collector = ErrorCollector(self.assertTrue)
2386 cpplint.ProcessFileData(
2387 "foo.cc",
2388 "cc",
2389 [
2390 "// Copyright 2014 Your Company.",
2391 "class OuterClass1 {",
2392 " private:",
2393 " struct InnerClass1 {",
2394 " private:",
2395 " %s(InnerClass1);" % macro_name,

Callers

nothing calls this directly

Calls 2

ResultsMethod · 0.95
ErrorCollectorClass · 0.85

Tested by

no test coverage detected