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

Method invalid_switches

test/testoptions.cpp:136–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134 }
135
136 void invalid_switches() const {
137 const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-a", "-v", "-q"};
138 options args(getArrayLength(argv), argv);
139 const std::map<std::string, std::set<std::string>> expected {
140 { "TestClass", { "TestMethod" } }
141 };
142 ASSERT(expected == args.which_tests());
143 ASSERT_EQUALS(true, args.quiet());
144 ASSERT_EQUALS(2, args.errors().size());
145 auto it = args.errors().cbegin();
146 ASSERT_EQUALS("unknown option '-a'", *it);
147 ++it;
148 ASSERT_EQUALS("unknown option '-v'", *it);
149 }
150
151 void summary() const {
152 const char* argv[] = {"./test_runner", "TestClass::TestMethod", "-n"};

Callers

nothing calls this directly

Calls 3

getArrayLengthFunction · 0.85
quietMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected