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

Method testClass

cpplint_unittest.py:6823–6858  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6821 assert len(self.nesting_state.stack) == 0
6822
6823 def testClass(self):
6824 self.UpdateWithLines(["class A {"])
6825 assert len(self.nesting_state.stack) == 1
6826 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6827 assert self.nesting_state.stack[0].name == "A"
6828 assert not self.nesting_state.stack[0].is_derived
6829 assert self.nesting_state.stack[0].class_indent == 0
6830
6831 self.UpdateWithLines(["};", "struct B : public A {"])
6832 assert len(self.nesting_state.stack) == 1
6833 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6834 assert self.nesting_state.stack[0].name == "B"
6835 assert self.nesting_state.stack[0].is_derived
6836
6837 self.UpdateWithLines(["};", "class C", ": public A {"])
6838 assert len(self.nesting_state.stack) == 1
6839 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6840 assert self.nesting_state.stack[0].name == "C"
6841 assert self.nesting_state.stack[0].is_derived
6842
6843 self.UpdateWithLines(["};", "template<T>"])
6844 assert len(self.nesting_state.stack) == 0
6845
6846 self.UpdateWithLines(["class D {", " class E {"])
6847 assert len(self.nesting_state.stack) == 2
6848 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6849 assert self.nesting_state.stack[0].name == "D"
6850 assert not self.nesting_state.stack[0].is_derived
6851 assert isinstance(self.nesting_state.stack[1], cpplint._ClassInfo)
6852 assert self.nesting_state.stack[1].name == "E"
6853 assert not self.nesting_state.stack[1].is_derived
6854 assert self.nesting_state.stack[1].class_indent == 2
6855 assert self.nesting_state.InnermostClass().name == "E"
6856
6857 self.UpdateWithLines(["}", "}"])
6858 assert len(self.nesting_state.stack) == 0
6859
6860 def testClassAccess(self):
6861 self.UpdateWithLines(["class A {"])

Callers

nothing calls this directly

Calls 2

UpdateWithLinesMethod · 0.95
InnermostClassMethod · 0.80

Tested by

no test coverage detected