Skip to content

Commit a2d9a42

Browse files
Update testnullpointer.cpp
1 parent 241cfcb commit a2d9a42

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

test/testnullpointer.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3489,8 +3489,7 @@ class TestNullPointer : public TestFixture {
34893489
" printf(\"%s\", s);\n"
34903490
"}");
34913491
ASSERT_EQUALS(
3492-
"[test.cpp:3:18]: (error) Null pointer dereference: s [nullPointer]\n"
3493-
"[test.cpp:3:18]: (error) Null pointer dereference [nullPointer]\n",
3492+
"[test.cpp:3:18]: (error) Null pointer dereference: s [nullPointer]\n",
34943493
errout_str());
34953494

34963495
check("void f() {\n"
@@ -3514,8 +3513,7 @@ class TestNullPointer : public TestFixture {
35143513
" printf(\"%u%s\", 123, s);\n"
35153514
"}");
35163515
ASSERT_EQUALS(
3517-
"[test.cpp:3:25]: (error) Null pointer dereference: s [nullPointer]\n"
3518-
"[test.cpp:3:25]: (error) Null pointer dereference [nullPointer]\n",
3516+
"[test.cpp:3:25]: (error) Null pointer dereference: s [nullPointer]\n",
35193517
errout_str());
35203518

35213519

@@ -3560,16 +3558,14 @@ class TestNullPointer : public TestFixture {
35603558
" sscanf(s, \"%s\", 0);\n"
35613559
"}");
35623560
ASSERT_EQUALS(
3563-
"[test.cpp:2:21]: (error) Null pointer dereference [nullPointer]\n"
3564-
"[test.cpp:2:21]: (error) Null pointer dereference [nullPointer]\n", // duplicate
3561+
"[test.cpp:2:21]: (error) Null pointer dereference [nullPointer]\n",
35653562
errout_str());
35663563

35673564
check("void f() {\n"
35683565
" scanf(\"%d\", 0);\n"
35693566
"}");
35703567
ASSERT_EQUALS(
3571-
"[test.cpp:2:17]: (error) Null pointer dereference [nullPointer]\n"
3572-
"[test.cpp:2:17]: (error) Null pointer dereference [nullPointer]\n", // duplicate
3568+
"[test.cpp:2:17]: (error) Null pointer dereference [nullPointer]\n",
35733569
errout_str());
35743570

35753571
check("void f(char* foo) {\n"
@@ -3590,9 +3586,7 @@ class TestNullPointer : public TestFixture {
35903586
" sscanf(dummy, \"%d\", iVal);\n"
35913587
"}");
35923588
ASSERT_EQUALS(
3593-
"[test.cpp:3:25]: (error) Null pointer dereference: iVal [nullPointer]\n"
3594-
"[test.cpp:3:25]: (error) Null pointer dereference [nullPointer]\n"
3595-
"[test.cpp:3:25]: (error) Null pointer dereference [nullPointer]\n", // duplicate
3589+
"[test.cpp:3:25]: (error) Null pointer dereference: iVal [nullPointer]\n",
35963590
errout_str());
35973591

35983592
check("void f(char *dummy) {\n"
@@ -3611,8 +3605,7 @@ class TestNullPointer : public TestFixture {
36113605
" sscanf(dummy, \"%*d%u\", 0);\n"
36123606
"}");
36133607
ASSERT_EQUALS(
3614-
"[test.cpp:2:28]: (error) Null pointer dereference [nullPointer]\n"
3615-
"[test.cpp:2:28]: (error) Null pointer dereference [nullPointer]\n", // duplicate
3608+
"[test.cpp:2:28]: (error) Null pointer dereference [nullPointer]\n",
36163609
errout_str());
36173610
}
36183611

@@ -4333,8 +4326,7 @@ class TestNullPointer : public TestFixture {
43334326
Library library;
43344327
ASSERT(LibraryHelper::loadxmldata(library, xmldata, sizeof(xmldata)));
43354328

4336-
std::list<const Token *> null;
4337-
CheckNullPointer::parseFunctionCall(*xtok, null, library);
4329+
const std::list<const Token *> null = CheckNullPointer::parseFunctionCall(*xtok, library);
43384330
ASSERT_EQUALS(0U, null.size());
43394331
}
43404332

@@ -4352,8 +4344,7 @@ class TestNullPointer : public TestFixture {
43524344
Library library;
43534345
ASSERT(LibraryHelper::loadxmldata(library, xmldata, sizeof(xmldata)));
43544346

4355-
std::list<const Token *> null;
4356-
CheckNullPointer::parseFunctionCall(*xtok, null, library);
4347+
const std::list<const Token *> null = CheckNullPointer::parseFunctionCall(*xtok, library);
43574348
ASSERT_EQUALS(1U, null.size());
43584349
ASSERT_EQUALS("a", null.front()->str());
43594350
}

0 commit comments

Comments
 (0)