mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Added support for manually registering test functions.
As discussed in #421
This commit is contained in:
		| @@ -830,6 +830,6 @@ with expansion: | ||||
|   "first" == "second" | ||||
|  | ||||
| =============================================================================== | ||||
| test cases: 166 | 123 passed | 42 failed |  1 failed as expected | ||||
| assertions: 913 | 817 passed | 83 failed | 13 failed as expected | ||||
| test cases: 167 | 124 passed | 42 failed |  1 failed as expected | ||||
| assertions: 914 | 818 passed | 83 failed | 13 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -6004,6 +6004,17 @@ with expansion: | ||||
|   ************************ | ||||
| ... message truncated due to excessive size | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| ManuallyRegistered | ||||
| ------------------------------------------------------------------------------- | ||||
| TestMain.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| TestMain.cpp:<line number>: | ||||
| PASSED: | ||||
| with message: | ||||
|   was called | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Parsing a std::pair | ||||
| ------------------------------------------------------------------------------- | ||||
| @@ -9034,6 +9045,6 @@ with expansion: | ||||
|   1 > 0 | ||||
|  | ||||
| =============================================================================== | ||||
| test cases: 166 | 122 passed | 43 failed |  1 failed as expected | ||||
| assertions: 915 | 817 passed | 85 failed | 13 failed as expected | ||||
| test cases: 167 | 123 passed | 43 failed |  1 failed as expected | ||||
| assertions: 916 | 818 passed | 85 failed | 13 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <testsuites> | ||||
|   <testsuite name="CatchSelfTest" errors="13" failures="72" tests="915" hostname="tbd" time="{duration}" timestamp="tbd"> | ||||
|   <testsuite name="CatchSelfTest" errors="13" failures="72" tests="916" hostname="tbd" time="{duration}" timestamp="tbd"> | ||||
|     <testcase classname="global" name="toString(enum)" time="{duration}"/> | ||||
|     <testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/> | ||||
|     <testcase classname="global" name="toString(enum class)" time="{duration}"/> | ||||
| @@ -547,6 +547,7 @@ hello | ||||
|     </testcase> | ||||
|     <testcase classname="global" name="Text can be formatted using the Text class" time="{duration}"/> | ||||
|     <testcase classname="global" name="Long text is truncted" time="{duration}"/> | ||||
|     <testcase classname="global" name="ManuallyRegistered" time="{duration}"/> | ||||
|     <testcase classname="global" name="Parsing a std::pair" time="{duration}"/> | ||||
|     <testcase classname="global" name="Where there is more to the expression after the RHS" time="{duration}"/> | ||||
|     <testcase classname="global" name="Where the LHS is not a simple value" time="{duration}"/> | ||||
|   | ||||
| @@ -6284,6 +6284,9 @@ there" | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="ManuallyRegistered"> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Parsing a std::pair"> | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/SelfTest/TrickyTests.cpp" > | ||||
|         <Original> | ||||
| @@ -9502,7 +9505,7 @@ there" | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <OverallResults successes="817" failures="85" expectedFailures="13"/> | ||||
|     <OverallResults successes="818" failures="85" expectedFailures="13"/> | ||||
|   </Group> | ||||
|   <OverallResults successes="817" failures="85" expectedFailures="13"/> | ||||
|   <OverallResults successes="818" failures="85" expectedFailures="13"/> | ||||
| </Catch> | ||||
|   | ||||
| @@ -449,3 +449,13 @@ TEST_CASE( "Long text is truncted", "[Text][Truncated]" ) { | ||||
|     CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) ); | ||||
|  | ||||
| } | ||||
|  | ||||
| inline void manuallyRegisteredTestFunction() { | ||||
|     SUCCEED( "was called" ); | ||||
| } | ||||
| struct AutoTestReg { | ||||
|     AutoTestReg() { | ||||
|         REGISTER_TEST_CASE( manuallyRegisteredTestFunction, "ManuallyRegistered", "" ); | ||||
|     } | ||||
| }; | ||||
| AutoTestReg autoTestReg; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash