Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/testbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class TestBufferOverrun : public TestFixture {
}

void run() override {
// TODO: mNewTemplate = true;
TEST_CASE(noerr1);
TEST_CASE(noerr2);
TEST_CASE(noerr3);
Expand Down
1 change: 1 addition & 0 deletions test/testcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TestCondition : public TestFixture {
"</def>";
settings1 = settingsBuilder(settings1).libraryxml(cfg).build();

// TODO: mNewTemplate = true;
TEST_CASE(assignAndCompare); // assignment and comparison don't match
TEST_CASE(mismatchingBitAnd); // overlapping bitmasks
TEST_CASE(comparison); // CheckCondition::comparison test cases
Expand Down
1 change: 1 addition & 0 deletions test/testconstructors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class TestConstructors : public TestFixture {
}

void run() override {
// TODO: mNewTemplate = true;
TEST_CASE(simple1);
TEST_CASE(simple2);
TEST_CASE(simple3);
Expand Down
1 change: 1 addition & 0 deletions test/testfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TestFunctions : public TestFixture {
certainty(Certainty::inconclusive).c(Standards::C11).cpp(Standards::CPP11).library("std.cfg").library("posix.cfg").build();

void run() override {
// TODO: mNewTemplate = true;
// Prohibited functions
TEST_CASE(prohibitedFunctions_posix);
TEST_CASE(prohibitedFunctions_index);
Expand Down
1 change: 1 addition & 0 deletions test/testleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TestLeakAutoVar : public TestFixture {
const Settings settings = settingsBuilder().library("std.cfg").build();

void run() override {
// TODO: mNewTemplate = true;
// Assign
TEST_CASE(assign1);
TEST_CASE(assign2);
Expand Down
268 changes: 136 additions & 132 deletions test/testmemleak.cpp

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions test/testpreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class TestPreprocessor : public TestFixture {
const Settings settings0 = settingsBuilder().severity(Severity::information).build();

void run() override {
mNewTemplate = true;

// The bug that started the whole work with the new preprocessor
TEST_CASE(Bug2190219);
Expand Down Expand Up @@ -373,7 +374,7 @@ class TestPreprocessor : public TestFixture {
const auto settings = dinit(Settings, $.userDefines = "__cplusplus");
const std::string code("#error hello world!\n");
(void)PreprocessorHelper::getcode(settings, *this, code, "X", "test.c");
ASSERT_EQUALS("[test.c:1]: (error) #error hello world!\n", errout_str());
ASSERT_EQUALS("[test.c:1:0]: (error) #error hello world! [preprocessorErrorDirective]\n", errout_str());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing column only occurs in the tests. It is present when using the CLI.

}

// Ticket #2919 - wrong filename reported for #error
Expand All @@ -383,15 +384,15 @@ class TestPreprocessor : public TestFixture {
const auto settings = dinit(Settings, $.userDefines = "TEST");
const std::string code("#file \"ab.h\"\n#error hello world!\n#endfile");
(void)PreprocessorHelper::getcode(settings, *this, code, "TEST", "test.c");
ASSERT_EQUALS("[ab.h:1]: (error) #error hello world!\n", errout_str());
ASSERT_EQUALS("[ab.h:1:0]: (error) #error hello world! [preprocessorErrorDirective]\n", errout_str());
}

// After including a file
{
const auto settings = dinit(Settings, $.userDefines = "TEST");
const std::string code("#file \"ab.h\"\n\n#endfile\n#error aaa");
(void)PreprocessorHelper::getcode(settings, *this, code, "TEST", "test.c");
ASSERT_EQUALS("[test.c:2]: (error) #error aaa\n", errout_str());
ASSERT_EQUALS("[test.c:2:0]: (error) #error aaa [preprocessorErrorDirective]\n", errout_str());
}
}

Expand Down Expand Up @@ -1464,7 +1465,7 @@ class TestPreprocessor : public TestFixture {
const std::map<std::string, std::string> actual = PreprocessorHelper::getcode(settings0, *this, filedata);

ASSERT_EQUALS(0, actual.size());
ASSERT_EQUALS("[file.c:2]: (error) No pair for character ('). Can't process file. File is either invalid or unicode, which is currently not supported.\n", errout_str());
ASSERT_EQUALS("[file.c:2:0]: (error) No pair for character ('). Can't process file. File is either invalid or unicode, which is currently not supported. [preprocessorErrorDirective]\n", errout_str());
}
}

Expand All @@ -1479,7 +1480,7 @@ class TestPreprocessor : public TestFixture {
const std::string actual(expandMacros(filedata, *this));

ASSERT_EQUALS("", actual);
ASSERT_EQUALS("[file.cpp:3]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported.\n", errout_str());
ASSERT_EQUALS("[file.cpp:3:0]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported. [preprocessorErrorDirective]\n", errout_str());
}

{
Expand All @@ -1492,7 +1493,7 @@ class TestPreprocessor : public TestFixture {
const std::string actual(expandMacros(filedata, *this));

ASSERT_EQUALS("", actual);
ASSERT_EQUALS("[abc.h:2]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported.\n", errout_str());
ASSERT_EQUALS("[abc.h:2:0]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported. [preprocessorErrorDirective]\n", errout_str());
}

{
Expand All @@ -1505,7 +1506,7 @@ class TestPreprocessor : public TestFixture {
const std::string actual(expandMacros(filedata, *this));

ASSERT_EQUALS("", actual);
ASSERT_EQUALS("[file.cpp:2]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported.\n", errout_str());
ASSERT_EQUALS("[file.cpp:2:0]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported. [preprocessorErrorDirective]\n", errout_str());
}

{
Expand All @@ -1517,7 +1518,7 @@ class TestPreprocessor : public TestFixture {
const std::string actual(expandMacros(filedata, *this));

ASSERT_EQUALS("", actual);
ASSERT_EQUALS("[file.cpp:2]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported.\n", errout_str());
ASSERT_EQUALS("[file.cpp:2:0]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported. [preprocessorErrorDirective]\n", errout_str());
}

{
Expand All @@ -1533,7 +1534,7 @@ class TestPreprocessor : public TestFixture {
// expand macros..
(void)expandMacros(filedata, *this);

ASSERT_EQUALS("[file.cpp:7]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported.\n", errout_str());
ASSERT_EQUALS("[file.cpp:7:0]: (error) No pair for character (\"). Can't process file. File is either invalid or unicode, which is currently not supported. [preprocessorErrorDirective]\n", errout_str());
}
}

Expand Down Expand Up @@ -1586,7 +1587,7 @@ class TestPreprocessor : public TestFixture {
// Compare results..
ASSERT_EQUALS(1, actual.size());
ASSERT_EQUALS("", actual.at(""));
ASSERT_EQUALS("[file.c:6]: (error) failed to expand 'BC', Wrong number of parameters for macro 'BC'.\n", errout_str());
ASSERT_EQUALS("[file.c:6:0]: (error) failed to expand 'BC', Wrong number of parameters for macro 'BC'. [preprocessorErrorDirective]\n", errout_str());
}

void newline_in_macro() {
Expand Down Expand Up @@ -1903,12 +1904,12 @@ class TestPreprocessor : public TestFixture {

void invalid_define_1() {
(void)PreprocessorHelper::getcode(settings0, *this, "#define =\n");
ASSERT_EQUALS("[file.c:1]: (error) Failed to parse #define\n", errout_str());
ASSERT_EQUALS("[file.c:1:0]: (error) Failed to parse #define [preprocessorErrorDirective]\n", errout_str());
}

void invalid_define_2() { // #4036
(void)PreprocessorHelper::getcode(settings0, *this, "#define () {(int f(x) }\n");
ASSERT_EQUALS("[file.c:1]: (error) Failed to parse #define\n", errout_str());
ASSERT_EQUALS("[file.c:1:0]: (error) Failed to parse #define [preprocessorErrorDirective]\n", errout_str());
}

void inline_suppressions() {
Expand Down Expand Up @@ -2037,7 +2038,7 @@ class TestPreprocessor : public TestFixture {
const char code[] = "#elif (){\n";
const std::string actual = PreprocessorHelper::getcode(settings0, *this, code, "TEST", "test.c");
ASSERT_EQUALS("", actual);
ASSERT_EQUALS("[test.c:1]: (error) #elif without #if\n", errout_str());
ASSERT_EQUALS("[test.c:1:0]: (error) #elif without #if [preprocessorErrorDirective]\n", errout_str());
}

void getConfigs1() {
Expand Down Expand Up @@ -2286,8 +2287,8 @@ class TestPreprocessor : public TestFixture {
// Preprocess => don't crash..
(void)PreprocessorHelper::getcode(settings0, *this, filedata);
ASSERT_EQUALS(
"[file.c:1]: (error) Syntax error in #ifdef\n"
"[file.c:1]: (error) Syntax error in #ifdef\n", errout_str());
"[file.c:1:0]: (error) Syntax error in #ifdef [preprocessorErrorDirective]\n"
"[file.c:1:0]: (error) Syntax error in #ifdef [preprocessorErrorDirective]\n", errout_str());
}

void garbage() {
Expand All @@ -2303,7 +2304,7 @@ class TestPreprocessor : public TestFixture {
const auto settings = dinit(Settings, $.userDefines = "foo");
const std::string code("#error hello world!\n");
(void)PreprocessorHelper::getcode(settings, *this, code, "X", "./././test.c");
ASSERT_EQUALS("[test.c:1]: (error) #error hello world!\n", errout_str());
ASSERT_EQUALS("[test.c:1:0]: (error) #error hello world! [preprocessorErrorDirective]\n", errout_str());
}

// test for existing local include
Expand Down
1 change: 1 addition & 0 deletions test/teststl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TestStl : public TestFixture {
/*const*/ Settings settings = settingsBuilder().severity(Severity::warning).severity(Severity::style).severity(Severity::performance).library("std.cfg").build();

void run() override {
// TODO: mNewTemplate = true;
TEST_CASE(outOfBounds);
TEST_CASE(outOfBoundsSymbolic);
TEST_CASE(outOfBoundsIndexExpression);
Expand Down
Loading
Loading