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

Method testTemplate

cpplint_unittest.py:6969–7008  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6967 assert len(self.nesting_state.stack) == 0
6968
6969 def testTemplate(self):
6970 self.UpdateWithLines(["template <T,", " class Arg1 = tmpl<T> >"])
6971 assert len(self.nesting_state.stack) == 0
6972 self.UpdateWithLines(["class A {"])
6973 assert len(self.nesting_state.stack) == 1
6974 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6975 assert self.nesting_state.stack[0].name == "A"
6976
6977 self.UpdateWithLines(
6978 ["};", "template <T,", " template <typename, typename> class B>", "class C"]
6979 )
6980 assert len(self.nesting_state.stack) == 1
6981 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6982 assert self.nesting_state.stack[0].name == "C"
6983 self.UpdateWithLines([";"])
6984 assert len(self.nesting_state.stack) == 0
6985
6986 self.UpdateWithLines(["class D : public Tmpl<E>"])
6987 assert len(self.nesting_state.stack) == 1
6988 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
6989 assert self.nesting_state.stack[0].name == "D"
6990
6991 self.UpdateWithLines(["{", "};"])
6992 assert len(self.nesting_state.stack) == 0
6993
6994 self.UpdateWithLines(
6995 [
6996 "template <class F,",
6997 " class G,",
6998 " class H,",
6999 " typename I>",
7000 "static void Func() {",
7001 ]
7002 )
7003 assert len(self.nesting_state.stack) == 1
7004 assert not isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
7005 self.UpdateWithLines(["}", "template <class J> class K {"])
7006 assert len(self.nesting_state.stack) == 1
7007 assert isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)
7008 assert self.nesting_state.stack[0].name == "K"
7009
7010 def testTemplateDefaultArg(self):
7011 self.UpdateWithLines(["template <class T, class D = default_delete<T>> class unique_ptr {"])

Callers

nothing calls this directly

Calls 1

UpdateWithLinesMethod · 0.95

Tested by

no test coverage detected