mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Split SelfTest test files into Usage and Introspective varieties
Usage: just exercises Catch. The tests are over arbitrary date/ types Introspective: Tests parts of Catch itself.
This commit is contained in:
		| @@ -6670,10 +6670,10 @@ PASSED: | ||||
| XmlEncode | ||||
|   normal string | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "normal string" ) == "normal string" ) | ||||
| with expansion: | ||||
| @@ -6683,10 +6683,10 @@ with expansion: | ||||
| XmlEncode | ||||
|   empty string | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "" ) == "" ) | ||||
| with expansion: | ||||
| @@ -6696,10 +6696,10 @@ with expansion: | ||||
| XmlEncode | ||||
|   string with ampersand | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "smith & jones" ) == "smith & jones" ) | ||||
| with expansion: | ||||
| @@ -6709,10 +6709,10 @@ with expansion: | ||||
| XmlEncode | ||||
|   string with less-than | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "smith < jones" ) == "smith < jones" ) | ||||
| with expansion: | ||||
| @@ -6722,16 +6722,16 @@ with expansion: | ||||
| XmlEncode | ||||
|   string with greater-than | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "smith > jones" ) == "smith > jones" ) | ||||
| with expansion: | ||||
|   "smith > jones" == "smith > jones" | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "smith ]]> jones" ) == "smith ]]> jones" ) | ||||
| with expansion: | ||||
| @@ -6743,10 +6743,10 @@ with expansion: | ||||
| XmlEncode | ||||
|   string with quotes | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( stringWithQuotes ) == stringWithQuotes ) | ||||
| with expansion: | ||||
| @@ -6754,7 +6754,7 @@ with expansion: | ||||
|   == | ||||
|   "don't "quote" me on that" | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" ) | ||||
| with expansion: | ||||
| @@ -6766,10 +6766,10 @@ with expansion: | ||||
| XmlEncode | ||||
|   string with control char (1) | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "[\x01]" ) == "[\\x01]" ) | ||||
| with expansion: | ||||
| @@ -6779,10 +6779,10 @@ with expansion: | ||||
| XmlEncode | ||||
|   string with control char (x7F) | ||||
| ------------------------------------------------------------------------------- | ||||
| MiscTests.cpp:<line number> | ||||
| XmlTests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| MiscTests.cpp:<line number>: | ||||
| XmlTests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" ) | ||||
| with expansion: | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,4 +1,4 @@ | ||||
| #include "../include/internal/catch_stringref.h" | ||||
| #include "internal/catch_stringref.h" | ||||
| 
 | ||||
| #include "catch.hpp" | ||||
| 
 | ||||
| @@ -8,9 +8,9 @@ | ||||
| 
 | ||||
| #define CATCH_CONFIG_MAIN | ||||
| #include "catch.hpp" | ||||
| #include "../include/reporters/catch_reporter_teamcity.hpp" | ||||
| #include "../include/reporters/catch_reporter_tap.hpp" | ||||
| #include "../include/reporters/catch_reporter_automake.hpp" | ||||
| #include "reporters/catch_reporter_teamcity.hpp" | ||||
| #include "reporters/catch_reporter_tap.hpp" | ||||
| #include "reporters/catch_reporter_automake.hpp" | ||||
| 
 | ||||
| 
 | ||||
| // Some example tag aliases
 | ||||
							
								
								
									
										41
									
								
								projects/SelfTest/IntrospectiveTests/XmlTests.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								projects/SelfTest/IntrospectiveTests/XmlTests.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| #include "catch.hpp" | ||||
|  | ||||
| #include "internal/catch_xmlwriter.h" | ||||
|  | ||||
| #include <sstream> | ||||
|  | ||||
| inline std::string encode( std::string const& str, Catch::XmlEncode::ForWhat forWhat = Catch::XmlEncode::ForTextNodes ) { | ||||
|     std::ostringstream oss; | ||||
|     oss << Catch::XmlEncode( str, forWhat ); | ||||
|     return oss.str(); | ||||
| } | ||||
|  | ||||
| TEST_CASE( "XmlEncode" ) { | ||||
|     SECTION( "normal string" ) { | ||||
|         REQUIRE( encode( "normal string" ) == "normal string" ); | ||||
|     } | ||||
|     SECTION( "empty string" ) { | ||||
|         REQUIRE( encode( "" ) == "" ); | ||||
|     } | ||||
|     SECTION( "string with ampersand" ) { | ||||
|         REQUIRE( encode( "smith & jones" ) == "smith & jones" ); | ||||
|     } | ||||
|     SECTION( "string with less-than" ) { | ||||
|         REQUIRE( encode( "smith < jones" ) == "smith < jones" ); | ||||
|     } | ||||
|     SECTION( "string with greater-than" ) { | ||||
|         REQUIRE( encode( "smith > jones" ) == "smith > jones" ); | ||||
|         REQUIRE( encode( "smith ]]> jones" ) == "smith ]]> jones" ); | ||||
|     } | ||||
|     SECTION( "string with quotes" ) { | ||||
|         std::string stringWithQuotes = "don't \"quote\" me on that"; | ||||
|         REQUIRE( encode( stringWithQuotes ) == stringWithQuotes ); | ||||
|         REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" ); | ||||
|     } | ||||
|     SECTION( "string with control char (1)" ) { | ||||
|         REQUIRE( encode( "[\x01]" ) == "[\\x01]" ); | ||||
|     } | ||||
|     SECTION( "string with control char (x7F)" ) { | ||||
|         REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" ); | ||||
|     } | ||||
| } | ||||
| @@ -13,7 +13,6 @@ | ||||
| #   pragma clang diagnostic ignored "-Wc++98-compat-pedantic" | ||||
| #endif | ||||
| 
 | ||||
| #include "internal/catch_xmlwriter.h" | ||||
| 
 | ||||
| #include <iostream> | ||||
| #include <cerrno> | ||||
| @@ -293,42 +292,6 @@ TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) { | ||||
|         CHECK( result == "\"wide load\"" ); | ||||
| } | ||||
| 
 | ||||
| inline std::string encode( std::string const& str, Catch::XmlEncode::ForWhat forWhat = Catch::XmlEncode::ForTextNodes ) { | ||||
|     std::ostringstream oss; | ||||
|     oss << Catch::XmlEncode( str, forWhat ); | ||||
|     return oss.str(); | ||||
| } | ||||
| 
 | ||||
| TEST_CASE( "XmlEncode" ) { | ||||
|     SECTION( "normal string" ) { | ||||
|         REQUIRE( encode( "normal string" ) == "normal string" ); | ||||
|     } | ||||
|     SECTION( "empty string" ) { | ||||
|         REQUIRE( encode( "" ) == "" ); | ||||
|     } | ||||
|     SECTION( "string with ampersand" ) { | ||||
|         REQUIRE( encode( "smith & jones" ) == "smith & jones" ); | ||||
|     } | ||||
|     SECTION( "string with less-than" ) { | ||||
|         REQUIRE( encode( "smith < jones" ) == "smith < jones" ); | ||||
|     } | ||||
|     SECTION( "string with greater-than" ) { | ||||
|         REQUIRE( encode( "smith > jones" ) == "smith > jones" ); | ||||
|         REQUIRE( encode( "smith ]]> jones" ) == "smith ]]> jones" ); | ||||
|     } | ||||
|     SECTION( "string with quotes" ) { | ||||
|         std::string stringWithQuotes = "don't \"quote\" me on that"; | ||||
|         REQUIRE( encode( stringWithQuotes ) == stringWithQuotes ); | ||||
|         REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" ); | ||||
|     } | ||||
|     SECTION( "string with control char (1)" ) { | ||||
|         REQUIRE( encode( "[\x01]" ) == "[\\x01]" ); | ||||
|     } | ||||
|     SECTION( "string with control char (x7F)" ) { | ||||
|         REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" ); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| TEST_CASE( "long long" ) { | ||||
|     long long l = std::numeric_limits<long long>::max(); | ||||
| 
 | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash