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

Method ErrorMessageCode

test/testerrorlogger.cpp:370–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368 }
369
370 void ErrorMessageCode() const {
371 ScopedFile file("code.cpp",
372 "int i;\n"
373 "int i2;\n"
374 "int i3;\n"
375 );
376
377 ErrorMessage::FileLocation codeCpp3_5{"code.cpp", 3, 5};
378 std::list<ErrorMessage::FileLocation> locs = { codeCpp3_5 };
379 ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal);
380 ASSERT_EQUALS(1, msg.callStack.size());
381 ASSERT_EQUALS("Programming error.", msg.shortMessage());
382 ASSERT_EQUALS("Verbose error", msg.verboseMessage());
383 ASSERT_EQUALS("code.cpp:3:5: error: Programming error. [errorId]\n"
384 "int i3;\n"
385 " ^",
386 msg.toString(false, "{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\n{code}", ""));
387 }
388
389 void CustomFormat() const {
390 std::list<ErrorMessage::FileLocation> locs(1, fooCpp5);

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected