Embed errout.str() into ASSERT_EQUALS() call.
Get rid of useless variables. No functional change.
This commit is contained in:
parent
2307395d6e
commit
4dd3835617
|
@ -414,8 +414,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" str[10] = 0;\n"
|
" str[10] = 0;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (all) Array index out of bounds\n", errout.str());
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (all) Array index out of bounds\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -456,8 +455,7 @@ private:
|
||||||
" for (i = 0; i <= 10; ++i)\n"
|
" for (i = 0; i <= 10; ++i)\n"
|
||||||
" a[i] = 0;\n"
|
" a[i] = 0;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (all) Buffer overrun\n", errout.str());
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (all) Buffer overrun\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,7 @@ private:
|
||||||
"public:\n"
|
"public:\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
std::string actual(errout.str());
|
ASSERT_EQUALS("[test.cpp:1]: (style) The class 'Fred' has no constructor\n", errout.str());
|
||||||
std::string expected("[test.cpp:1]: (style) The class 'Fred' has no constructor\n");
|
|
||||||
ASSERT_EQUALS(expected, actual);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,8 +184,7 @@ private:
|
||||||
" { i = fred.i; return *this; }\n"
|
" { i = fred.i; return *this; }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
ASSERT_EQUALS("", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,8 +236,7 @@ private:
|
||||||
" };\n"
|
" };\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
ASSERT_EQUALS("", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initvar_chained_assign()
|
void initvar_chained_assign()
|
||||||
|
@ -260,8 +256,7 @@ private:
|
||||||
" m_iMyInt1 = m_iMyInt2 = 0;\n"
|
" m_iMyInt1 = m_iMyInt2 = 0;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
ASSERT_EQUALS("", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,8 +290,7 @@ private:
|
||||||
" m_iMyInt = 0;\n"
|
" m_iMyInt = 0;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
ASSERT_EQUALS("", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1222,8 +1222,8 @@ private:
|
||||||
" char *p = new char[100];\n"
|
" char *p = new char[100];\n"
|
||||||
" foo(p);\n"
|
" foo(p);\n"
|
||||||
"}\n", true);
|
"}\n", true);
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Mismatching allocation and deallocation: str\n",
|
||||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Mismatching allocation and deallocation: str\n", err);
|
errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1239,8 +1239,7 @@ private:
|
||||||
" char *p = new char[100];\n"
|
" char *p = new char[100];\n"
|
||||||
" foo(p);\n"
|
" foo(p);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: p\n", errout.str());
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: p\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1258,8 +1257,7 @@ private:
|
||||||
" char *p = new char[100];\n"
|
" char *p = new char[100];\n"
|
||||||
" foo(p);\n"
|
" foo(p);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
std::string err(errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: p\n", errout.str());
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: p\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1471,9 +1469,7 @@ private:
|
||||||
" return;\n"
|
" return;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("[test.cpp:12]: (error) Memory leak: s2\n", errout.str());
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:12]: (error) Memory leak: s2\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1995,9 +1991,7 @@ private:
|
||||||
" memset(&(out[0]), 0, 1);\n"
|
" memset(&(out[0]), 0, 1);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
std::string err(errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: out\n", errout.str());
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: out\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void strndup_function()
|
void strndup_function()
|
||||||
|
|
Loading…
Reference in New Issue