"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/testsuppressions.cpp" between
cppcheck-1.86.tar.gz and cppcheck-1.87.tar.gz

About: Cppcheck is a static analysis tool for C/C++ code. It checks for memory leaks, mismatching allocation-deallocation, buffer overrun, and many more.

testsuppressions.cpp  (cppcheck-1.86):testsuppressions.cpp  (cppcheck-1.87)
/* /*
* Cppcheck - A tool for static C/C++ code analysis * Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2018 Cppcheck team. * Copyright (C) 2007-2019 Cppcheck team.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 41 skipping to change at line 41
#include <utility> #include <utility>
#include <vector> #include <vector>
class TestSuppressions : public TestFixture { class TestSuppressions : public TestFixture {
public: public:
TestSuppressions() : TestFixture("TestSuppressions") { TestSuppressions() : TestFixture("TestSuppressions") {
} }
private: private:
void run() override { void run() OVERRIDE {
TEST_CASE(suppressionsBadId1); TEST_CASE(suppressionsBadId1);
TEST_CASE(suppressionsDosFormat); // Ticket #1836 TEST_CASE(suppressionsDosFormat); // Ticket #1836
TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon
TEST_CASE(suppressionsGlob); TEST_CASE(suppressionsGlob);
TEST_CASE(suppressionsFileNameWithExtraPath); TEST_CASE(suppressionsFileNameWithExtraPath);
TEST_CASE(suppressionsSettings); TEST_CASE(suppressionsSettings);
TEST_CASE(suppressionsMultiFile); TEST_CASE(suppressionsMultiFile);
TEST_CASE(suppressionsPathSeparator); TEST_CASE(suppressionsPathSeparator);
TEST_CASE(suppressionsLine0); TEST_CASE(suppressionsLine0);
TEST_CASE(suppressionsFileComment);
TEST_CASE(inlinesuppress); TEST_CASE(inlinesuppress);
TEST_CASE(inlinesuppress_symbolname); TEST_CASE(inlinesuppress_symbolname);
TEST_CASE(inlinesuppress_comment); TEST_CASE(inlinesuppress_comment);
TEST_CASE(globalSuppressions); // Testing that global suppressions work (#8515) TEST_CASE(globalSuppressions); // Testing that global suppressions work (#8515)
TEST_CASE(inlinesuppress_unusedFunction); // #4210 - unusedFunction TEST_CASE(inlinesuppress_unusedFunction); // #4210 - unusedFunction
TEST_CASE(globalsuppress_unusedFunction); // #4946 TEST_CASE(globalsuppress_unusedFunction); // #4946
TEST_CASE(suppressionWithRelativePaths); // #4733 TEST_CASE(suppressionWithRelativePaths); // #4733
skipping to change at line 414 skipping to change at line 415
const Suppressions::Suppression s2("abc", "include/1.h"); const Suppressions::Suppression s2("abc", "include/1.h");
ASSERT_EQUALS(true, s2.isSuppressed(errorMessage("abc", "include/1.h", 1 42))); ASSERT_EQUALS(true, s2.isSuppressed(errorMessage("abc", "include/1.h", 1 42)));
} }
void suppressionsLine0() { void suppressionsLine0() {
Suppressions suppressions; Suppressions suppressions;
suppressions.addSuppressionLine("syntaxError:*:0"); suppressions.addSuppressionLine("syntaxError:*:0");
ASSERT_EQUALS(true, suppressions.isSuppressed(errorMessage("syntaxError" , "test.cpp", 0))); ASSERT_EQUALS(true, suppressions.isSuppressed(errorMessage("syntaxError" , "test.cpp", 0)));
} }
void suppressionsFileComment() {
std::istringstream file1("# comment\nabc");
Suppressions suppressions1;
suppressions1.parseFile(file1);
ASSERT_EQUALS(true, suppressions1.isSuppressed(errorMessage("abc", "test
.cpp", 123)));
std::istringstream file2("// comment\nabc");
Suppressions suppressions2;
suppressions2.parseFile(file2);
ASSERT_EQUALS(true, suppressions2.isSuppressed(errorMessage("abc", "test
.cpp", 123)));
}
void inlinesuppress() { void inlinesuppress() {
Suppressions::Suppression s; Suppressions::Suppression s;
std::string msg; std::string msg;
ASSERT_EQUALS(false, s.parseComment("/* some text */", &msg)); ASSERT_EQUALS(false, s.parseComment("/* some text */", &msg));
ASSERT_EQUALS(false, s.parseComment("/* cppcheck-suppress */", &msg)); ASSERT_EQUALS(false, s.parseComment("/* cppcheck-suppress */", &msg));
msg.clear(); msg.clear();
ASSERT_EQUALS(true, s.parseComment("/* cppcheck-suppress id */", &msg)); ASSERT_EQUALS(true, s.parseComment("/* cppcheck-suppress id */", &msg));
ASSERT_EQUALS("", msg); ASSERT_EQUALS("", msg);
 End of changes. 4 change blocks. 
2 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)