Skip to content

Commit ee62bfc

Browse files
committed
aligned Settings::library and Settings::libraries in tests / added TODOs
1 parent b9b8e5b commit ee62bfc

File tree

9 files changed

+18
-4
lines changed

9 files changed

+18
-4
lines changed

test/testautovariables.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class TestAutoVariables : public TestFixture {
5252
settings.severity.enable(Severity::style);
5353
LOAD_LIB_2(settings.library, "std.cfg");
5454
LOAD_LIB_2(settings.library, "qt.cfg");
55+
settings.libraries.emplace_back("qt");
5556

5657
TEST_CASE(testautovar1);
5758
TEST_CASE(testautovar2);

test/testbufferoverrun.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5488,6 +5488,7 @@ class TestBufferOverrun : public TestFixture {
54885488

54895489
Settings settings;
54905490
LOAD_LIB_2(settings.library, "posix.cfg");
5491+
settings.libraries.emplace_back("posix");
54915492

54925493
check("void f(){\n"
54935494
"int pipefd[1];\n" // <-- array of two integers is needed

test/testcondition.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class TestCondition : public TestFixture {
4949
PLATFORM(settings1, cppcheck::Platform::Native);
5050

5151
LOAD_LIB_2(settings0.library, "qt.cfg");
52+
settings0.libraries.emplace_back("qt");
5253
LOAD_LIB_2(settings0.library, "std.cfg");
5354

5455
settings0.severity.enable(Severity::style);

test/testconstructors.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,7 +1952,8 @@ class TestConstructors : public TestFixture {
19521952

19531953
void initvar_smartptr() { // #10237
19541954
Settings s;
1955-
s.libraries.emplace_back("std");
1955+
// TODO: test shuld probably not pass without library
1956+
//LOAD_LIB_2(s.library, "std.cfg");
19561957
check("struct S {\n"
19571958
" explicit S(const std::shared_ptr<S>& sp) {\n"
19581959
" set(*sp);\n"
@@ -3589,7 +3590,9 @@ class TestConstructors : public TestFixture {
35893590

35903591
void uninitVarInheritClassInit() {
35913592
Settings s;
3592-
s.libraries.emplace_back("vcl");
3593+
// TODO: test should probably not pass without library
3594+
//LOAD_LIB_2(s.library, "vcl.cfg");
3595+
//s.libraries.emplace_back("vcl");
35933596

35943597
check("class Fred: public TObject\n"
35953598
"{\n"

test/testfunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class TestFunctions : public TestFixture {
4343
settings.severity.enable(Severity::performance);
4444
settings.severity.enable(Severity::portability);
4545
settings.certainty.enable(Certainty::inconclusive);
46-
settings.libraries.emplace_back("posix");
4746
settings.standards.c = Standards::C11;
4847
settings.standards.cpp = Standards::CPP11;
4948
LOAD_LIB_2(settings.library, "std.cfg");
5049
LOAD_LIB_2(settings.library, "posix.cfg");
50+
settings.libraries.emplace_back("posix");
5151

5252
// Prohibited functions
5353
TEST_CASE(prohibitedFunctions_posix);

test/testio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TestIO : public TestFixture {
3939
LOAD_LIB_2(settings.library, "std.cfg");
4040
LOAD_LIB_2(settings.library, "windows.cfg");
4141
LOAD_LIB_2(settings.library, "qt.cfg");
42+
settings.libraries.emplace_back("qt");
4243

4344
TEST_CASE(coutCerrMisusage);
4445

test/testleakautovar.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ class TestLeakAutoVar : public TestFixture {
472472
void assign23() {
473473
Settings s = settings;
474474
LOAD_LIB_2(settings.library, "posix.cfg");
475+
settings.libraries.emplace_back("posix");
475476
check("void f() {\n"
476477
" int n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14;\n"
477478
" *&n1 = open(\"xx.log\", O_RDONLY);\n"
@@ -1852,6 +1853,7 @@ class TestLeakAutoVar : public TestFixture {
18521853
Settings s;
18531854
LOAD_LIB_2(s.library, "std.cfg");
18541855
LOAD_LIB_2(s.library, "posix.cfg");
1856+
s.libraries.emplace_back("posix");
18551857

18561858
check("void f() {\n"
18571859
" char* temp = strdup(\"temp.txt\");\n"

test/testmemleak.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class TestMemleakInFunction : public TestFixture {
151151
void run() override {
152152
LOAD_LIB_2(settings1.library, "std.cfg");
153153
LOAD_LIB_2(settings1.library, "posix.cfg");
154+
settings1.libraries.emplace_back("posix");
154155
LOAD_LIB_2(settings2.library, "std.cfg");
155156

156157
TEST_CASE(realloc1);
@@ -1705,6 +1706,7 @@ class TestMemleakStructMember : public TestFixture {
17051706
void run() override {
17061707
LOAD_LIB_2(settings.library, "std.cfg");
17071708
LOAD_LIB_2(settings.library, "posix.cfg");
1709+
settings.libraries.emplace_back("posix");
17081710

17091711
// testing that errors are detected
17101712
TEST_CASE(err);
@@ -2291,11 +2293,11 @@ class TestMemleakNoVar : public TestFixture {
22912293

22922294
void run() override {
22932295
settings.certainty.setEnabled(Certainty::inconclusive, true);
2294-
settings.libraries.emplace_back("posix");
22952296
settings.severity.enable(Severity::warning);
22962297

22972298
LOAD_LIB_2(settings.library, "std.cfg");
22982299
LOAD_LIB_2(settings.library, "posix.cfg");
2300+
settings.libraries.emplace_back("posix");
22992301

23002302
// pass allocated memory to function..
23012303
TEST_CASE(functionParameter);

test/testtokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ class TestTokenizer : public TestFixture {
5858
settings_windows.checkUnusedTemplates = true;
5959

6060
// library=qt
61+
LOAD_LIB_2(settings0.library, "qt.cfg");
6162
settings0.libraries.emplace_back("qt");
63+
LOAD_LIB_2(settings1.library, "qt.cfg");
6264
settings1.libraries.emplace_back("qt");
65+
LOAD_LIB_2(settings2.library, "qt.cfg");
6366
settings2.libraries.emplace_back("qt");
6467

6568
TEST_CASE(tokenize1);

0 commit comments

Comments
 (0)