@@ -78,6 +78,7 @@ class TestErrorLogger : public TestFixture {
7878 TEST_CASE (isCriticalErrorId);
7979
8080 TEST_CASE (ErrorMessageReportTypeMisraC);
81+ TEST_CASE (ErrorMessageReportTypeMisraCDirective);
8182 TEST_CASE (ErrorMessageReportTypeCertC);
8283 }
8384
@@ -328,6 +329,19 @@ class TestErrorLogger : public TestFixture {
328329 ASSERT_EQUALS (" Advisory 2.8" , msg.toString (true , format, " " ));
329330 }
330331
332+ void ErrorMessageReportTypeMisraCDirective () const {
333+ std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
334+ const auto reportType = ReportType::misraC;
335+ const auto mapping = createGuidelineMapping (reportType);
336+ const std::string format = " {severity} {id}" ;
337+ ErrorMessage msg (std::move (locs), emptyString, Severity::style, " " , " premium-misra-c-2012-dir-4.6" , Certainty::normal);
338+ msg.guideline = getGuideline (msg.id , reportType, mapping, msg.severity );
339+ msg.classification = getClassification (msg.id , msg.guideline , reportType);
340+ ASSERT_EQUALS (" Advisory" , msg.classification );
341+ ASSERT_EQUALS (" 4.6" , msg.guideline );
342+ ASSERT_EQUALS (" Advisory 4.6" , msg.toString (true , format, " " ));
343+ }
344+
331345 void ErrorMessageReportTypeCertC () const {
332346 std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
333347 const auto reportType = ReportType::certC;
0 commit comments