Document and test Token::concatStr()

This commit is contained in:
Thomas Jarosch 2011-10-23 21:21:42 +02:00
parent 5b97cc1440
commit 1ccb57e595
2 changed files with 17 additions and 0 deletions

View File

@ -48,6 +48,10 @@ public:
void str(const std::string &s);
/**
* Concatenate two strings. "hello" "world" -> "hello world"
* Note: Automatically cuts of the last/first character.
*/
void concatStr(std::string const& b);
const std::string &str() const {

View File

@ -48,6 +48,7 @@ private:
TEST_CASE(matchOr);
TEST_CASE(updateProperties)
TEST_CASE(updatePropertiesConcatStr)
TEST_CASE(isNameGuarantees1)
TEST_CASE(isNameGuarantees2)
TEST_CASE(isNameGuarantees3)
@ -274,6 +275,18 @@ private:
ASSERT_EQUALS(true, tok.isNumber());
}
void updatePropertiesConcatStr() {
Token tok(NULL);
tok.str("true");
ASSERT_EQUALS(true, tok.isBoolean());
tok.concatStr("123");
ASSERT_EQUALS(false, tok.isBoolean());
ASSERT_EQUALS("tru23", tok.str());
}
void isNameGuarantees1() {
Token tok(NULL);
tok.str("Name");