diff options
| author | Phil Nash | 2013-03-28 22:13:31 +0000 |
|---|---|---|
| committer | Phil Nash | 2013-03-28 22:13:31 +0000 |
| commit | 15fd03260839d667df0dac008cbe40e83f451fb5 (patch) | |
| tree | e9a9b309924a61feceab1592d6d49ccfc285b831 /projects/SelfTest/TestMain.cpp | |
| parent | 9e8abc33e7a4e8c0d0b69a3fd827ce92c31da951 (diff) | |
| download | catch3-15fd03260839d667df0dac008cbe40e83f451fb5.tar.gz | |
Use new line wrapper to show test case list, with tags, in columns
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
| -rw-r--r-- | projects/SelfTest/TestMain.cpp | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index 9f1e3d4d..ad363d6a 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -432,31 +432,40 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) { std::string testString = "one two three four"; SECTION( "No wrapping", "" ) { - CHECK( Catch::LineWrapper( 80 ).wrap( testString ).toString() == testString ); - CHECK( Catch::LineWrapper( 18 ).wrap( testString ).toString() == testString ); + CHECK( Catch::LineWrapper().setRight( 80 ).wrap( testString ).toString() == testString ); + CHECK( Catch::LineWrapper().setRight( 18 ).wrap( testString ).toString() == testString ); } SECTION( "Wrapped once", "" ) { - CHECK( Catch::LineWrapper( 17 ).wrap( testString ).toString() == "one two three\nfour" ); - CHECK( Catch::LineWrapper( 16 ).wrap( testString ).toString() == "one two three\nfour" ); - CHECK( Catch::LineWrapper( 15 ).wrap( testString ).toString() == "one two three\nfour" ); - CHECK( Catch::LineWrapper( 14 ).wrap( testString ).toString() == "one two three\nfour" ); - CHECK( Catch::LineWrapper( 13 ).wrap( testString ).toString() == "one two\nthree four" ); + CHECK( Catch::LineWrapper().setRight( 17 ).wrap( testString ).toString() == "one two three\nfour" ); + CHECK( Catch::LineWrapper().setRight( 16 ).wrap( testString ).toString() == "one two three\nfour" ); + CHECK( Catch::LineWrapper().setRight( 15 ).wrap( testString ).toString() == "one two three\nfour" ); + CHECK( Catch::LineWrapper().setRight( 14 ).wrap( testString ).toString() == "one two three\nfour" ); + CHECK( Catch::LineWrapper().setRight( 13 ).wrap( testString ).toString() == "one two\nthree four" ); } SECTION( "Wrapped twice", "" ) { - CHECK( Catch::LineWrapper( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" ); - CHECK( Catch::LineWrapper( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" ); } SECTION( "Wrapped three times", "" ) { - CHECK( Catch::LineWrapper( 7 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" ); - CHECK( Catch::LineWrapper( 5 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 7 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 5 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" ); } SECTION( "Short wrap", "" ) { - CHECK( Catch::LineWrapper( 4 ).wrap( "abcdef" ).toString() == "abc-\ndef" ); - CHECK( Catch::LineWrapper( 4 ).wrap( "abcdefg" ).toString() == "abc-\ndefg" ); - CHECK( Catch::LineWrapper( 4 ).wrap("abcdefgh" ).toString() == "abc-\ndef-\ngh" ); - - CHECK( Catch::LineWrapper( 4 ).wrap( testString ).toString() == "one\ntwo\nthr-\nee\nfour" ); - CHECK( Catch::LineWrapper( 3 ).wrap( testString ).toString() == "one\ntwo\nth-\nree\nfo-\nur" ); + CHECK( Catch::LineWrapper().setRight( 4 ).wrap( "abcdef" ).toString() == "abc-\ndef" ); + CHECK( Catch::LineWrapper().setRight( 4 ).wrap( "abcdefg" ).toString() == "abc-\ndefg" ); + CHECK( Catch::LineWrapper().setRight( 4 ).wrap("abcdefgh" ).toString() == "abc-\ndef-\ngh" ); + + CHECK( Catch::LineWrapper().setRight( 4 ).wrap( testString ).toString() == "one\ntwo\nthr-\nee\nfour" ); + CHECK( Catch::LineWrapper().setRight( 3 ).wrap( testString ).toString() == "one\ntwo\nth-\nree\nfo-\nur" ); + } + SECTION( "As container", "" ) { + Catch::LineWrapper wrapper; + wrapper.setRight( 7 ).wrap( testString ); + CHECK( wrapper.size() == 4 ); + CHECK( wrapper[0] == "one" ); + CHECK( wrapper[1] == "two" ); + CHECK( wrapper[2] == "three" ); + CHECK( wrapper[3] == "four" ); } } @@ -466,22 +475,22 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) { std::string testString = "one two\nthree four"; SECTION( "No wrapping" , "" ) { - CHECK( Catch::LineWrapper( 80 ).wrap( testString ).toString() == testString ); - CHECK( Catch::LineWrapper( 18 ).wrap( testString ).toString() == testString ); - CHECK( Catch::LineWrapper( 10 ).wrap( testString ).toString() == testString ); + CHECK( Catch::LineWrapper().setRight( 80 ).wrap( testString ).toString() == testString ); + CHECK( Catch::LineWrapper().setRight( 18 ).wrap( testString ).toString() == testString ); + CHECK( Catch::LineWrapper().setRight( 10 ).wrap( testString ).toString() == testString ); } SECTION( "Trailing newline" , "" ) { - CHECK( Catch::LineWrapper( 10 ).wrap( "abcdef\n" ).toString() == "abcdef\n" ); - CHECK( Catch::LineWrapper( 6 ).wrap( "abcdef" ).toString() == "abcdef" ); - CHECK( Catch::LineWrapper( 6 ).wrap( "abcdef\n" ).toString() == "abcdef\n" ); + CHECK( Catch::LineWrapper().setRight( 10 ).wrap( "abcdef\n" ).toString() == "abcdef\n" ); + CHECK( Catch::LineWrapper().setRight( 6 ).wrap( "abcdef" ).toString() == "abcdef" ); + CHECK( Catch::LineWrapper().setRight( 6 ).wrap( "abcdef\n" ).toString() == "abcdef\n" ); } SECTION( "Wrapped once", "" ) { - CHECK( Catch::LineWrapper( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" ); - CHECK( Catch::LineWrapper( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" ); - CHECK( Catch::LineWrapper( 7 ).wrap( testString ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 7 ).wrap( testString ).toString() == "one two\nthree\nfour" ); } SECTION( "Wrapped twice", "" ) { - CHECK( Catch::LineWrapper( 6 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" ); + CHECK( Catch::LineWrapper().setRight( 6 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" ); } } |