mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Ignore leading/trailing whitespace in test/section specs
The leading/trailing whitespace is problematic because of e.g. `WHEN` macro having preceeding whitespace for alignment, and it is generally messy. Credits to Phil who did lot of the original work. Closes #1708
This commit is contained in:
		| @@ -262,7 +262,24 @@ TEST_CASE( "Parse test names and tags" ) { | ||||
|         CHECK( spec.matches( tcC ) == false ); | ||||
|         CHECK( spec.matches( tcD ) == true ); | ||||
|     } | ||||
|     SECTION( "Leading and trailing spaces in test spec" ) { | ||||
|         TestSpec spec = parseTestSpec( "\"  aardvark \"" ); | ||||
|         CHECK( spec.matches( fakeTestCase( "  aardvark " ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( "  aardvark" ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( " aardvark " ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( "aardvark " ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( "aardvark" ) ) ); | ||||
|  | ||||
|     } | ||||
|     SECTION( "Leading and trailing spaces in test name" ) { | ||||
|         TestSpec spec = parseTestSpec( "aardvark" ); | ||||
|         CHECK( spec.matches( fakeTestCase( "  aardvark " ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( "  aardvark" ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( " aardvark " ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( "aardvark " ) ) ); | ||||
|         CHECK( spec.matches( fakeTestCase( "aardvark" ) ) ); | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
| TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský