MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / function_match_scope

Method function_match_scope

test/testlibrary.cpp:123–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 }
122
123 void function_match_scope() const {
124 constexpr char xmldata[] = "<?xml version=\"1.0\"?>\n"
125 "<def>\n"
126 " <function name=\"foo\">\n"
127 " <arg nr=\"1\"/>"
128 " </function>\n"
129 "</def>";
130
131 Library library;
132 ASSERT(LibraryHelper::loadxmldata(library, xmldata, sizeof(xmldata)));
133 {
134 const char code[] = "fred.foo(123);"; // <- wrong scope, not library function
135 const SimpleTokenList tokenList(code);
136
137 ASSERT(library.isNotLibraryFunction(tokenList.front()->tokAt(2)));
138 }
139 {
140 const char code[] = "Fred::foo(123);"; // <- wrong scope, not library function
141 const SimpleTokenList tokenList(code);
142
143 ASSERT(library.isNotLibraryFunction(tokenList.front()->tokAt(2)));
144 }
145 }
146
147 void function_match_args() const {
148 constexpr char xmldata[] = "<?xml version=\"1.0\"?>\n"

Callers

nothing calls this directly

Calls 3

isNotLibraryFunctionMethod · 0.80
frontMethod · 0.80
tokAtMethod · 0.45

Tested by

no test coverage detected