Refactorizations in test suite:

- Removed another custom stringify implementation (testtoken.cpp)
- Removed unnecessary forward declaration (testsuite.h)
- Use std::ostringstream instead of std::stringstream (redirect.h)
This commit is contained in:
PKEuS 2012-04-17 12:57:16 +02:00
parent 8e5949c6ce
commit a971e1530b
3 changed files with 3 additions and 11 deletions

View File

@ -62,8 +62,8 @@ public:
} }
private: private:
std::stringstream _out; std::ostringstream _out;
std::stringstream _err; std::ostringstream _err;
std::streambuf* _oldCout; std::streambuf* _oldCout;
std::streambuf *_oldCerr; std::streambuf *_oldCerr;
}; };

View File

@ -26,8 +26,6 @@
class options; class options;
class Token;
class TestFixture : public ErrorLogger { class TestFixture : public ErrorLogger {
private: private:
static std::ostringstream errmsg; static std::ostringstream errmsg;

View File

@ -207,13 +207,7 @@ private:
void eraseTokens() { void eraseTokens() {
givenACodeSampleToTokenize code("begin ; { this code will be removed } end"); givenACodeSampleToTokenize code("begin ; { this code will be removed } end");
Token::eraseTokens(code.tokens()->next(), code.tokens()->tokAt(9)); Token::eraseTokens(code.tokens()->next(), code.tokens()->tokAt(9));
std::ostringstream ret; ASSERT_EQUALS("begin ; end", code.tokens()->stringifyList(0, false));
for (const Token *tok = code.tokens(); tok; tok = tok->next()) {
if (tok != code.tokens())
ret << " ";
ret << tok->str();
}
ASSERT_EQUALS("begin ; end", ret.str());
} }