Strip redundant std::string usage from tests.

Second round: handle empty strings.

Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|'

Should be no functional change.
This commit is contained in:
Slava Semushin 2009-06-05 07:39:36 +07:00
parent 6745d9b8ef
commit 52a8368b02
13 changed files with 146 additions and 146 deletions

View File

@ -123,7 +123,7 @@ private:
" char str[50];\n" " char str[50];\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -145,7 +145,7 @@ private:
"{\n" "{\n"
" strcpy(buf, str);\n" " strcpy(buf, str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -156,7 +156,7 @@ private:
" char data[1];\n" " char data[1];\n"
" return abc.data[1];\n" " return abc.data[1];\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -168,7 +168,7 @@ private:
" char data[100];\n" " char data[100];\n"
" const char *p = &data[100];\n" " const char *p = &data[100];\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -181,7 +181,7 @@ private:
" char data[10];\n" " char data[10];\n"
" data[ sizeof(*data) ] = 0;\n" " data[ sizeof(*data) ] = 0;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void sizeof2() void sizeof2()
@ -191,7 +191,7 @@ private:
" char data[10];\n" " char data[10];\n"
" data[ sizeof(data[0]) ] = 0;\n" " data[ sizeof(data[0]) ] = 0;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("static void f()\n" check("static void f()\n"
"{\n" "{\n"
@ -500,7 +500,7 @@ private:
" char str[5];\n" " char str[5];\n"
" snprintf(str, 5, \"%s\", \"abc\");\n" " snprintf(str, 5, \"%s\", \"abc\");\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void snprintf3() void snprintf3()
@ -510,7 +510,7 @@ private:
" char str[5];\n" " char str[5];\n"
" snprintf(str, sizeof str, \"%s\", \"abc\");\n" " snprintf(str, sizeof str, \"%s\", \"abc\");\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void snprintf4() void snprintf4()
@ -520,7 +520,7 @@ private:
" char str[5];\n" " char str[5];\n"
" snprintf(str, 8 - x, \"abcdefghijkl\");\n" " snprintf(str, 8 - x, \"abcdefghijkl\");\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -572,7 +572,7 @@ private:
" str[30] = 0;\n" " str[30] = 0;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -587,7 +587,7 @@ private:
" memset(str,0,50);\n" " memset(str,0,50);\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void assign1() void assign1()

View File

@ -65,7 +65,7 @@ private:
" unsigned char ch = 0x80;\n" " unsigned char ch = 0x80;\n"
" buf[ch] = 0;\n" " buf[ch] = 0;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
@ -106,7 +106,7 @@ private:
" char ch;\n" " char ch;\n"
" func(&ch);\n" " func(&ch);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void return1() void return1()
@ -116,7 +116,7 @@ private:
" char c;\n" " char c;\n"
" return &c;\n" " return &c;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };

View File

@ -81,10 +81,10 @@ private:
// Base class not found // Base class not found
checkVirtualDestructor("class Derived : public Base { };"); checkVirtualDestructor("class Derived : public Base { };");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
checkVirtualDestructor("class Derived : Base { };"); checkVirtualDestructor("class Derived : Base { };");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void virtualDestructor2() void virtualDestructor2()
@ -97,7 +97,7 @@ private:
checkVirtualDestructor("class Base { };\n" checkVirtualDestructor("class Base { };\n"
"class Derived : Base { public: ~Derived() { (void)11; } };"); "class Derived : Base { public: ~Derived() { (void)11; } };");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void virtualDestructor3() void virtualDestructor3()
@ -119,11 +119,11 @@ private:
checkVirtualDestructor("class Base { public: ~Base(); };\n" checkVirtualDestructor("class Base { public: ~Base(); };\n"
"class Derived : public Base { };"); "class Derived : public Base { };");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
checkVirtualDestructor("class Base { public: ~Base(); };\n" checkVirtualDestructor("class Base { public: ~Base(); };\n"
"class Derived : private Fred, public Base { };"); "class Derived : private Fred, public Base { };");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void virtualDestructor5() void virtualDestructor5()
@ -132,11 +132,11 @@ private:
checkVirtualDestructor("class Base { public: ~Base(); };\n" checkVirtualDestructor("class Base { public: ~Base(); };\n"
"class Derived : public Base { public: ~Derived() {} };"); "class Derived : public Base { public: ~Derived() {} };");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
checkVirtualDestructor("class Base { public: ~Base(); };\n" checkVirtualDestructor("class Base { public: ~Base(); };\n"
"class Derived : public Base { public: ~Derived(); }; Derived::~Derived() {}"); "class Derived : public Base { public: ~Derived(); }; Derived::~Derived() {}");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void virtualDestructorProtected() void virtualDestructorProtected()
@ -154,7 +154,7 @@ private:
"public:\n" "public:\n"
" ~B() { int a; }\n" " ~B() { int a; }\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void checkUninitVar(const char code[]) void checkUninitVar(const char code[])
@ -223,7 +223,7 @@ private:
" }\n" " }\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void uninitVarTypedef() void uninitVarTypedef()
@ -246,7 +246,7 @@ private:
" Foo() { }\n" " Foo() { }\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void privateCtor2() void privateCtor2()
@ -282,7 +282,7 @@ private:
" return p;\n" " return p;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }

View File

@ -146,7 +146,7 @@ private:
" { this->i = 0; }\n" " { this->i = 0; }\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void initvar_if() void initvar_if()
@ -163,7 +163,7 @@ private:
" }\n" " }\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void initvar_operator_eq1() void initvar_operator_eq1()
@ -187,7 +187,7 @@ private:
"};\n"); "};\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), err); ASSERT_EQUALS("", err);
} }
@ -214,7 +214,7 @@ private:
" Init() { i = 0; }\n" " Init() { i = 0; }\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void initvar_same_classname() void initvar_same_classname()
@ -240,7 +240,7 @@ private:
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), err); ASSERT_EQUALS("", err);
} }
void initvar_chained_assign() void initvar_chained_assign()
@ -261,7 +261,7 @@ private:
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), err); ASSERT_EQUALS("", err);
} }
@ -296,7 +296,7 @@ private:
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), err); ASSERT_EQUALS("", err);
} }
@ -337,7 +337,7 @@ private:
"};\n" "};\n"
"Fred::Fred()\n" "Fred::Fred()\n"
"{ }"); "{ }");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void initvar_destructor() void initvar_destructor()
@ -350,7 +350,7 @@ private:
" Fred() : var(0) {}\n" " Fred() : var(0) {}\n"
" ~Fred() {}\n" " ~Fred() {}\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void operatorEqSTL() void operatorEqSTL()

View File

@ -113,7 +113,7 @@ private:
" unsigned int i2;\n" " unsigned int i2;\n"
" result = i2 / i1;}\n" " result = i2 / i1;}\n"
); );
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void division5() void division5()
@ -124,7 +124,7 @@ private:
" unsigned int val = 32;\n" " unsigned int val = 32;\n"
" val = val / USER_HASH;}\n" " val = val / USER_HASH;}\n"
); );
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void division6() void division6()

View File

@ -66,7 +66,7 @@ private:
" { }\n" " { }\n"
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void return1() void return1()
@ -76,7 +76,7 @@ private:
" return f1();\n" " return f1();\n"
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void callback1() void callback1()
@ -86,7 +86,7 @@ private:
" void (*f)() = cond ? f1 : NULL;\n" " void (*f)() = cond ? f1 : NULL;\n"
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void else1() void else1()
@ -97,7 +97,7 @@ private:
" else f1();\n" " else f1();\n"
"}\n"); "}\n");
std::string err(errout.str()); std::string err(errout.str());
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void functionpointer() void functionpointer()
@ -111,7 +111,7 @@ private:
" f(&abc::foo);\n" " f(&abc::foo);\n"
" return 0\n" " return 0\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };

View File

@ -80,7 +80,7 @@ private:
"#endif\n" "#endif\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void test2() void test2()
@ -100,7 +100,7 @@ private:
" const char *str[] = { \"abc\" };\n" " const char *str[] = { \"abc\" };\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void test4() void test4()
@ -115,7 +115,7 @@ private:
"};\n" "};\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void test5() void test5()
@ -143,13 +143,13 @@ private:
"};\n" "};\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void intarray() void intarray()
{ {
check("int arr[] = { 100/2, 1*100 };\n"); check("int arr[] = { 100/2, 1*100 };\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void structarraynull() void structarraynull()
@ -158,7 +158,7 @@ private:
" { 100/2, 1*100 }\n" " { 100/2, 1*100 }\n"
" { 90, 70 }\n" " { 90, 70 }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void structarray() void structarray()
@ -167,7 +167,7 @@ private:
" { 100/2, 1*100 }\n" " { 100/2, 1*100 }\n"
" { 90, 70 }\n" " { 90, 70 }\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };

View File

@ -245,7 +245,7 @@ private:
" Fred *f = new Fred;\n" " Fred *f = new Fred;\n"
" return f;\n" " return f;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void simple3() void simple3()
@ -255,7 +255,7 @@ private:
" char *s = new char[100];\n" " char *s = new char[100];\n"
" return (char *)s;\n" " return (char *)s;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -277,7 +277,7 @@ private:
" struct *str = new strlist;\n" " struct *str = new strlist;\n"
" return &str->s;\n" " return &str->s;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -289,7 +289,7 @@ private:
" char *str2 = (char *)str;\n" " char *str2 = (char *)str;\n"
" free(str2);\n" " free(str2);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -301,7 +301,7 @@ private:
"{\n" "{\n"
" Fred *f = new Fred;\n" " Fred *f = new Fred;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -315,7 +315,7 @@ private:
" { }\n" " { }\n"
" return str;\n" " return str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -327,7 +327,7 @@ private:
" c->free(c);\n" " c->free(c);\n"
" delete c;\n" " delete c;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void simple10() void simple10()
@ -337,7 +337,7 @@ private:
" FILE * f = fopen(fname, str);\n" " FILE * f = fopen(fname, str);\n"
" if ( fclose(f) != NULL );\n" " if ( fclose(f) != NULL );\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -371,7 +371,7 @@ private:
" DeleteString(str);\n" " DeleteString(str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -384,7 +384,7 @@ private:
" *somestr = str;\n" " *somestr = str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -402,7 +402,7 @@ private:
" delete [] a;\n" " delete [] a;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -432,7 +432,7 @@ private:
" return;\n" " return;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void f()\n" check("void f()\n"
"{\n" "{\n"
@ -459,7 +459,7 @@ private:
" }\n" " }\n"
" delete [] str;\n" " delete [] str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -478,7 +478,7 @@ private:
" }\n" " }\n"
" delete [] str;\n" " delete [] str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -508,7 +508,7 @@ private:
" }\n" " }\n"
" return s;\n" " return s;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -523,7 +523,7 @@ private:
" }\n" " }\n"
" return 0;\n" " return 0;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -537,7 +537,7 @@ private:
" delete [] s;\n" " delete [] s;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -555,7 +555,7 @@ private:
" str[0] = s;\n" " str[0] = s;\n"
" }\n" " }\n"
"}\n", true); "}\n", true);
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -584,7 +584,7 @@ private:
" return;\n" " return;\n"
" kfree( smp );\n" " kfree( smp );\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if3() void if3()
@ -595,7 +595,7 @@ private:
" if (0 != s)\n" " if (0 != s)\n"
" foo(s);\n" " foo(s);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if4() void if4()
@ -609,7 +609,7 @@ private:
" if (b)\n" " if (b)\n"
" free(s);\n" " free(s);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if5() void if5()
@ -621,7 +621,7 @@ private:
" return;\n" " return;\n"
" free(p);\n" " free(p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if6() void if6()
@ -637,7 +637,7 @@ private:
"\n" "\n"
" fclose( a );\n" " fclose( a );\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if7() void if7()
@ -654,7 +654,7 @@ private:
" delete [] a;\n" " delete [] a;\n"
" else {}\n" " else {}\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if8() void if8()
@ -689,7 +689,7 @@ private:
" buf = tmp;\n" " buf = tmp;\n"
" return buf;\n" " return buf;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void if10() void if10()
@ -739,7 +739,7 @@ private:
" }\n" " }\n"
" free(str);\n" " free(str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -801,7 +801,7 @@ private:
" }\n" " }\n"
" return str;\n" " return str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -875,7 +875,7 @@ private:
"\n" "\n"
" return a;\n" " return a;\n"
"}\n", true); "}\n", true);
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -932,7 +932,7 @@ private:
" };\n" " };\n"
" delete [] str;\n" " delete [] str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void switch2() void switch2()
@ -984,7 +984,7 @@ private:
" return *str = ret;\n" " return *str = ret;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1030,7 +1030,7 @@ private:
" char *c = new char[50];\n" " char *c = new char[50];\n"
" return (c ? c : NULL);\n" " return (c ? c : NULL);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void ret6() void ret6()
@ -1040,7 +1040,7 @@ private:
" char *c = new char[50];\n" " char *c = new char[50];\n"
" return strcpy(c, \"foo\");\n" " return strcpy(c, \"foo\");\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void ret7() void ret7()
@ -1050,7 +1050,7 @@ private:
" char *c = new char[50];\n" " char *c = new char[50];\n"
" return memcpy(c, \"foo\",4);\n" " return memcpy(c, \"foo\",4);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1076,7 +1076,7 @@ private:
" fp = popen();\n" " fp = popen();\n"
" pclose(fp);\n" " pclose(fp);\n"
"}\n", false); "}\n", false);
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void mismatch3() void mismatch3()
@ -1091,7 +1091,7 @@ private:
" if (abc) fclose(fp);\n" " if (abc) fclose(fp);\n"
" else pclose(fp);\n" " else pclose(fp);\n"
"}\n", false); "}\n", false);
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void mismatch4() void mismatch4()
@ -1124,7 +1124,7 @@ private:
" char *p = new char[100];\n" " char *p = new char[100];\n"
" foo(p);\n" " foo(p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1135,7 +1135,7 @@ private:
" char *p = new char[100];\n" " char *p = new char[100];\n"
" foo.add(p);\n" " foo.add(p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1165,7 +1165,7 @@ private:
" char *p = new char[100];\n" " char *p = new char[100];\n"
" foo(p);\n" " foo(p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1229,7 +1229,7 @@ private:
" char *str = new char[100];" " char *str = new char[100];"
" (*release)(str);\n" " (*release)(str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1247,7 +1247,7 @@ private:
" return;\n" " return;\n"
" delete [] a;\n" " delete [] a;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void func10() void func10()
@ -1257,7 +1257,7 @@ private:
" char *c = malloc(50);\n" " char *c = malloc(50);\n"
" (fnc)(c);\n" " (fnc)(c);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void func11() void func11()
@ -1267,7 +1267,7 @@ private:
" char *c = malloc(50);\n" " char *c = malloc(50);\n"
" (s1->fnc)(c);\n" " (s1->fnc)(c);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void func12() void func12()
@ -1287,7 +1287,7 @@ private:
"\n" "\n"
" add_list(base);\n" " add_list(base);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void func13() void func13()
@ -1297,7 +1297,7 @@ private:
" char *p = malloc(100);\n" " char *p = malloc(100);\n"
" foo(&p);\n" " foo(&p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1425,7 +1425,7 @@ private:
" }\n" " }\n"
"}\n", true); "}\n", true);
TODO_ASSERT_EQUALS(std::string(""), errout.str()); TODO_ASSERT_EQUALS("", errout.str());
} }
void class4() void class4()
@ -1600,7 +1600,7 @@ private:
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1619,7 +1619,7 @@ private:
" func(&ab->a);\n" " func(&ab->a);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1682,7 +1682,7 @@ private:
" free(a);\n" " free(a);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void realloc4() void realloc4()
@ -1717,7 +1717,7 @@ private:
" free(p);\n" " free(p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
@ -1726,7 +1726,7 @@ private:
" free(p);\n" " free(p);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
@ -1735,7 +1735,7 @@ private:
" free(a - 10);\n" " free(a - 10);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
@ -1744,7 +1744,7 @@ private:
" free(a - 10);\n" " free(a - 10);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
@ -1752,7 +1752,7 @@ private:
" list += a;\n" " list += a;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1767,7 +1767,7 @@ private:
" }\n" " }\n"
" free(p);\n" " free(p);\n"
"}\n"); "}\n");
TODO_ASSERT_EQUALS(std::string(""), errout.str()); TODO_ASSERT_EQUALS("", errout.str());
} }
void cast1() void cast1()
@ -1788,7 +1788,7 @@ private:
" free((void *)a);\n" " free((void *)a);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void cast3() void cast3()
@ -1799,7 +1799,7 @@ private:
" free(reinterpret_cast<void *>(a));\n" " free(reinterpret_cast<void *>(a));\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1840,7 +1840,7 @@ private:
" free(str);\n" " free(str);\n"
" foo(&str);\n" " foo(&str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void dealloc_use_3() void dealloc_use_3()
@ -1852,7 +1852,7 @@ private:
" f1(&str);\n" " f1(&str);\n"
" f2(str);\n" " f2(str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void dealloc_use_4() void dealloc_use_4()
@ -1863,7 +1863,7 @@ private:
" ReadDir( subdir );\n" " ReadDir( subdir );\n"
" closedir(subdir);\n" " closedir(subdir);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void dealloc_use_5() void dealloc_use_5()
@ -1885,7 +1885,7 @@ private:
" free(str);\n" " free(str);\n"
" printf(\"free %x\", str);\n" " printf(\"free %x\", str);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void dealloc_use_7() void dealloc_use_7()
@ -1919,7 +1919,7 @@ private:
" fprintf(fd, \"test\");\n" " fprintf(fd, \"test\");\n"
" fclose(fd);\n" " fclose(fd);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void strcat_result_assignment() void strcat_result_assignment()
@ -1932,7 +1932,7 @@ private:
" free( p );\n" " free( p );\n"
" return 0;\n" " return 0;\n"
"}"); "}");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -1943,7 +1943,7 @@ private:
"{\n" "{\n"
" Fred *f = new Fred;\n" " Fred *f = new Fred;\n"
"}\n", false); "}\n", false);
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
@ -2144,7 +2144,7 @@ private:
" FILE *f = popen (\"test\", \"w\");\n" " FILE *f = popen (\"test\", \"w\");\n"
" int a = pclose(f);\n" " int a = pclose(f);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void exit1() void exit1()
@ -2160,7 +2160,7 @@ private:
" }\n" " }\n"
" delete [] out;\n" " delete [] out;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void exit2() void exit2()
@ -2170,7 +2170,7 @@ private:
" char *out = new char[100];\n" " char *out = new char[100];\n"
" exit(0);\n" " exit(0);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void stdstring() void stdstring()
@ -2241,14 +2241,14 @@ private:
" FILE *f = fopen(fname, str);\n" " FILE *f = fopen(fname, str);\n"
" fcloseall();\n" " fcloseall();\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void f()\n" check("void f()\n"
"{\n" "{\n"
" FILE *f = tmpfile();\n" " FILE *f = tmpfile();\n"
" fcloseall();\n" " fcloseall();\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void opendir_function() void opendir_function()
@ -2276,21 +2276,21 @@ private:
" DIR *f = opendir(\".\");\n" " DIR *f = opendir(\".\");\n"
" closedir(f);\n" " closedir(f);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void f(int fd)\n" check("void f(int fd)\n"
"{\n" "{\n"
" DIR *f = fdopendir(fd);\n" " DIR *f = fdopendir(fd);\n"
" closedir(f);\n" " closedir(f);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
" DIR * f = opendir(dirname);\n" " DIR * f = opendir(dirname);\n"
" if (closedir(f));\n" " if (closedir(f));\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void dir_functions() void dir_functions()
@ -2343,7 +2343,7 @@ private:
" *c = 0;\n" " *c = 0;\n"
" *data = c;\n" " *data = c;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void dealloc_and_alloc_in_func() void dealloc_and_alloc_in_func()
@ -2362,7 +2362,7 @@ private:
" delete [] a;\n" " delete [] a;\n"
" return 0;\n" " return 0;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };

View File

@ -110,7 +110,7 @@ private:
" }\n" " }\n"
" cout<<b/sum;\n" " cout<<b/sum;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -125,7 +125,7 @@ private:
" p = 0;\n" " p = 0;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void delete2() void delete2()
@ -172,7 +172,7 @@ private:
" break;\n" " break;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -213,7 +213,7 @@ private:
" char buf[100];\n" " char buf[100];\n"
" sprintf(buf,\"%i\",sizeof(buf));\n" " sprintf(buf,\"%i\",sizeof(buf));\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void sprintf3() void sprintf3()
@ -224,7 +224,7 @@ private:
" sprintf(buf,\"%i\",sizeof(buf));\n" " sprintf(buf,\"%i\",sizeof(buf));\n"
" if (buf[0]);\n" " if (buf[0]);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void sprintf4() void sprintf4()
@ -240,7 +240,7 @@ private:
" struct A a;\n" " struct A a;\n"
" snprintf(a.filename, 128, \"%s\", filename);\n" " snprintf(a.filename, 128, \"%s\", filename);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -293,7 +293,7 @@ private:
" std::string temp = \"/tmp\";\n" " std::string temp = \"/tmp\";\n"
" std::string path = temp + '/' + \"sub\" + '/';\n" " std::string path = temp + '/' + \"sub\" + '/';\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -332,7 +332,7 @@ private:
" char str[100] = {0};\n" " char str[100] = {0};\n"
" return str;\n" " return str;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void varScope(const char code[]) void varScope(const char code[])
@ -381,7 +381,7 @@ private:
"\n" "\n"
" return 1;\n" " return 1;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void varScope2() void varScope2()
@ -392,7 +392,7 @@ private:
" e.SetValue(12);\n" " e.SetValue(12);\n"
" throw e;\n" " throw e;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void varScope3() void varScope3()
@ -407,7 +407,7 @@ private:
" }\n" " }\n"
" *p = 1;\n" " *p = 1;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -451,7 +451,7 @@ private:
" while (fred);\n" " while (fred);\n"
" fred.hello();\n" " fred.hello();\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };

View File

@ -158,7 +158,7 @@ private:
" foo[ii] = 0;\n" " foo[ii] = 0;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
{ {
@ -169,7 +169,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
{ {
@ -187,7 +187,7 @@ private:
" }\n" " }\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
} }

View File

@ -1987,7 +1987,7 @@ private:
Tokenizer tokenizer(s, this); Tokenizer tokenizer(s, this);
std::istringstream istr(code); std::istringstream istr(code);
ASSERT_EQUALS(true, tokenizer.tokenize(istr, "test.cpp")); ASSERT_EQUALS(true, tokenizer.tokenize(istr, "test.cpp"));
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
{ {
@ -2015,7 +2015,7 @@ private:
std::istringstream istr(code); std::istringstream istr(code);
ASSERT_EQUALS(true, tokenizer.tokenize(istr, "test.cpp")); ASSERT_EQUALS(true, tokenizer.tokenize(istr, "test.cpp"));
tokenizer.simplifyTokenList(); tokenizer.simplifyTokenList();
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
} }

View File

@ -100,7 +100,7 @@ private:
"\n" "\n"
"A::A()\n" "A::A()\n"
"{ }\n"); "{ }\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -116,7 +116,7 @@ private:
"\n" "\n"
"A::~A()\n" "A::~A()\n"
"{ B(); }\n"); "{ B(); }\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -132,7 +132,7 @@ private:
"\n" "\n"
"A::A() : _owner(false)\n" "A::A() : _owner(false)\n"
"{ b(); }\n"); "{ b(); }\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -180,7 +180,7 @@ private:
" int numOfThreads;\n" " int numOfThreads;\n"
"};\n"); "};\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }

View File

@ -89,7 +89,7 @@ private:
" int b = abc.b;\n" " int b = abc.b;\n"
" int c = abc.c;\n" " int c = abc.c;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
void structmember3() void structmember3()
@ -109,7 +109,7 @@ private:
" int b = abc[0].b;\n" " int b = abc[0].b;\n"
" int c = abc[0].c;\n" " int c = abc[0].c;\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -125,7 +125,7 @@ private:
" ABC abc;\n" " ABC abc;\n"
" if (abc.a == 2);\n" " if (abc.a == 2);\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -147,7 +147,7 @@ private:
" struct AB ab;\n" " struct AB ab;\n"
" ab.reset();\n" " ab.reset();\n"
"}\n"); "}\n");
ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };