@@ -78,6 +78,7 @@ class TestErrorLogger : public TestFixture {
78
78
TEST_CASE (isCriticalErrorId);
79
79
80
80
TEST_CASE (ErrorMessageReportTypeMisraC);
81
+ TEST_CASE (ErrorMessageReportTypeMisraCDirective);
81
82
TEST_CASE (ErrorMessageReportTypeCertC);
82
83
}
83
84
@@ -317,7 +318,7 @@ class TestErrorLogger : public TestFixture {
317
318
318
319
void ErrorMessageReportTypeMisraC () const {
319
320
std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
320
- const auto reportType = ReportType::misraC ;
321
+ const auto reportType = ReportType::misraC2012 ;
321
322
const auto mapping = createGuidelineMapping (reportType);
322
323
const std::string format = " {severity} {id}" ;
323
324
ErrorMessage msg (std::move (locs), emptyString, Severity::error, " " , " unusedVariable" , Certainty::normal);
@@ -328,6 +329,19 @@ class TestErrorLogger : public TestFixture {
328
329
ASSERT_EQUALS (" Advisory 2.8" , msg.toString (true , format, " " ));
329
330
}
330
331
332
+ void ErrorMessageReportTypeMisraCDirective () const {
333
+ std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
334
+ const auto reportType = ReportType::misraC2012;
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.guideline , reportType);
340
+ ASSERT_EQUALS (" Advisory" , msg.classification );
341
+ ASSERT_EQUALS (" Dir 4.6" , msg.guideline );
342
+ ASSERT_EQUALS (" Advisory Dir 4.6" , msg.toString (true , format, " " ));
343
+ }
344
+
331
345
void ErrorMessageReportTypeCertC () const {
332
346
std::list<ErrorMessage::FileLocation> locs = { fooCpp5 };
333
347
const auto reportType = ReportType::certC;
0 commit comments