@@ -79,6 +79,7 @@ class TestCppcheck : public TestFixture {
7979 TEST_CASE (isPremiumCodingStandardId);
8080 TEST_CASE (getDumpFileContentsRawTokens);
8181 TEST_CASE (getDumpFileContentsLibrary);
82+ TEST_CASE (checkPlistOutput);
8283 TEST_CASE (premiumResultsCache);
8384 TEST_CASE (toomanyconfigs);
8485 TEST_CASE (purgedConfiguration);
@@ -522,6 +523,43 @@ class TestCppcheck : public TestFixture {
522523 }
523524 }
524525
526+ void checkPlistOutput () const {
527+ Suppressions supprs;
528+ ErrorLogger2 errorLogger;
529+ std::vector<std::string> files = {" textfile.txt" };
530+
531+ {
532+ const auto s = dinit (Settings, $.templateFormat = templateFormat, $.plistOutput = " output" );
533+ const ScopedFile file (" file" , " " );
534+ CppCheck cppcheck (s, supprs, errorLogger, false , {});
535+ const FileWithDetails fileWithDetails {file.path (), Path::identify (file.path (), false ), 0 };
536+
537+ cppcheck.checkPlistOutput (fileWithDetails, files);
538+ const std::string outputFile {" outputfile_" + std::to_string (std::hash<std::string> {}(fileWithDetails.spath ())) + " .plist" };
539+ ASSERT (Path::exists (outputFile));
540+ std::remove (outputFile.c_str ());
541+ }
542+
543+ {
544+ const auto s = dinit (Settings, $.plistOutput = " output" );
545+ const ScopedFile file (" file.c" , " " );
546+ CppCheck cppcheck (s, supprs, errorLogger, false , {});
547+ const FileWithDetails fileWithDetails {file.path (), Path::identify (file.path (), false ), 0 };
548+
549+ cppcheck.checkPlistOutput (fileWithDetails, files);
550+ const std::string outputFile {" outputfile_" + std::to_string (std::hash<std::string> {}(fileWithDetails.spath ())) + " .plist" };
551+ ASSERT (Path::exists (outputFile));
552+ std::remove (outputFile.c_str ());
553+ }
554+
555+ {
556+ Settings s;
557+ const ScopedFile file (" file.c" , " " );
558+ CppCheck cppcheck (s, supprs, errorLogger, false , {});
559+ cppcheck.checkPlistOutput (FileWithDetails (file.path (), Path::identify (file.path (), false ), 0 ), files);
560+ }
561+ }
562+
525563 void premiumResultsCache () const {
526564 // Trac #13889 - cached misra results are shown after removing --premium=misra-c-2012 option
527565
0 commit comments