Fixed #2797 (Inline suppressions do not handle filenames correctly)

This commit is contained in:
Daniel Marjamäki 2011-06-29 20:23:39 +02:00
parent cacca00080
commit d76861270a
2 changed files with 11 additions and 1 deletions

View File

@ -17,6 +17,7 @@
*/
#include "settings.h"
#include "path.h"
#include <algorithm>
#include <fstream>
@ -224,7 +225,7 @@ std::string Settings::Suppressions::FileMatcher::addFile(const std::string &name
}
else
{
_files[name][line] = false;
_files[Path::simplifyPath(name.c_str())][line] = false;
}
return "";
}

View File

@ -37,6 +37,7 @@ private:
TEST_CASE(suppressionsDosFormat); // Ticket #1836
TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon
TEST_CASE(suppressionsGlob);
TEST_CASE(suppressionsFileNameWithExtraPath);
}
void suppressionsBadId1()
@ -99,6 +100,14 @@ private:
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 2));
}
}
void suppressionsFileNameWithExtraPath()
{
// Ticket #2797
Settings::Suppressions suppressions;
suppressions.addSuppression("errorid", "./a.c", 123);
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "a.c", 123));
}
};
REGISTER_TEST(TestSettings)