Embed errout.str() into ASSERT_EQUALS() call.

Get rid of useless variables.

No functional change.
This commit is contained in:
Slava Semushin 2009-06-14 12:33:46 +07:00
parent 2307395d6e
commit 4dd3835617
3 changed files with 13 additions and 27 deletions

View File

@ -414,8 +414,7 @@ private:
"{\n"
" str[10] = 0;\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("[test.cpp:10]: (all) Array index out of bounds\n", err);
ASSERT_EQUALS("[test.cpp:10]: (all) Array index out of bounds\n", errout.str());
}
@ -456,8 +455,7 @@ private:
" for (i = 0; i <= 10; ++i)\n"
" a[i] = 0;\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("[test.cpp:7]: (all) Buffer overrun\n", err);
ASSERT_EQUALS("[test.cpp:7]: (all) Buffer overrun\n", errout.str());
}

View File

@ -86,9 +86,7 @@ private:
"public:\n"
" int i;\n"
"};\n");
std::string actual(errout.str());
std::string expected("[test.cpp:1]: (style) The class 'Fred' has no constructor\n");
ASSERT_EQUALS(expected, actual);
ASSERT_EQUALS("[test.cpp:1]: (style) The class 'Fred' has no constructor\n", errout.str());
}
@ -186,8 +184,7 @@ private:
" { i = fred.i; return *this; }\n"
"};\n");
std::string err(errout.str());
ASSERT_EQUALS("", err);
ASSERT_EQUALS("", errout.str());
}
@ -239,8 +236,7 @@ private:
" };\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("", err);
ASSERT_EQUALS("", errout.str());
}
void initvar_chained_assign()
@ -260,8 +256,7 @@ private:
" m_iMyInt1 = m_iMyInt2 = 0;\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("", err);
ASSERT_EQUALS("", errout.str());
}
@ -295,8 +290,7 @@ private:
" m_iMyInt = 0;\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("", err);
ASSERT_EQUALS("", errout.str());
}

View File

@ -1222,8 +1222,8 @@ private:
" char *p = new char[100];\n"
" foo(p);\n"
"}\n", true);
std::string err(errout.str());
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Mismatching allocation and deallocation: str\n", err);
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Mismatching allocation and deallocation: str\n",
errout.str());
}
@ -1239,8 +1239,7 @@ private:
" char *p = new char[100];\n"
" foo(p);\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: p\n", err);
ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: p\n", errout.str());
}
@ -1258,8 +1257,7 @@ private:
" char *p = new char[100];\n"
" foo(p);\n"
"}\n");
std::string err(errout.str());
TODO_ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: p\n", err);
TODO_ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: p\n", errout.str());
}
@ -1471,9 +1469,7 @@ private:
" return;\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("[test.cpp:12]: (error) Memory leak: s2\n", err);
ASSERT_EQUALS("[test.cpp:12]: (error) Memory leak: s2\n", errout.str());
}
@ -1995,9 +1991,7 @@ private:
" memset(&(out[0]), 0, 1);\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: out\n", err);
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: out\n", errout.str());
}
void strndup_function()