Refactoring a big test into smaller tests

This commit is contained in:
Strahinja Val Markovic 2013-08-30 14:46:33 -07:00
parent 62462b48bc
commit d2fe03f072

View File

@ -30,7 +30,7 @@ using ::testing::ElementsAre;
using ::testing::ContainerEq; using ::testing::ContainerEq;
using ::testing::WhenSorted; using ::testing::WhenSorted;
TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextWorks ) { TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextComments ) {
EXPECT_STREQ( RemoveIdentifierFreeText( EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n" "foo \n"
"bar //foo \n" "bar //foo \n"
@ -58,7 +58,10 @@ TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextWorks ) {
"foo \n" "foo \n"
"bar \n" "bar \n"
"qux" ); "qux" );
}
TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextSimpleStrings ) {
EXPECT_STREQ( RemoveIdentifierFreeText( EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n" "foo \n"
"bar 'foo'\n" "bar 'foo'\n"
@ -68,15 +71,6 @@ TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextWorks ) {
"bar \n" "bar \n"
"qux" ); "qux" );
EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n"
"bar 'fo\\'oz\\nfoo'\n"
"qux"
).c_str(),
"foo \n"
"bar \n"
"qux" );
EXPECT_STREQ( RemoveIdentifierFreeText( EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n" "foo \n"
"bar \"foo\"\n" "bar \"foo\"\n"
@ -85,6 +79,19 @@ TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextWorks ) {
"foo \n" "foo \n"
"bar \n" "bar \n"
"qux" ); "qux" );
}
TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextEscapedQuotesInStrings ) {
EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n"
"bar 'fo\\'oz\\nfoo'\n"
"qux"
).c_str(),
"foo \n"
"bar \n"
"qux" );
EXPECT_STREQ( RemoveIdentifierFreeText( EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n" "foo \n"
@ -94,7 +101,10 @@ TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextWorks ) {
"foo \n" "foo \n"
"bar \n" "bar \n"
"qux" ); "qux" );
}
TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextEscapedSlashesInStrings ) {
EXPECT_STREQ( RemoveIdentifierFreeText( EXPECT_STREQ( RemoveIdentifierFreeText(
"foo \n" "foo \n"
"bar \"fo\\\\\"baz\n" "bar \"fo\\\\\"baz\n"
@ -112,7 +122,10 @@ TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextWorks ) {
"foo \n" "foo \n"
"bar \n" "bar \n"
"qux " ); "qux " );
}
TEST( IdentifierUtilsTest, RemoveIdentifierFreeTextEscapedQuotesStartStrings ) {
EXPECT_STREQ( RemoveIdentifierFreeText( EXPECT_STREQ( RemoveIdentifierFreeText(
"\\\"foo\\\"" "\\\"foo\\\""
"'\"'" "'\"'"