@@ -9,57 +9,57 @@ namespace NUnit.Engine.Services
9
9
public class TestSelectionParserTests
10
10
{
11
11
// Category Filter
12
- [ TestCase ( "cat=Urgent" , "<cat>Urgent</cat>" ) ]
13
- [ TestCase ( "cat==Urgent" , "<cat>Urgent</cat>" ) ]
14
- [ TestCase ( "cat!=Urgent" , "<not><cat>Urgent</cat></not>" ) ]
15
- [ TestCase ( "cat =~ Urgent" , "<cat re='1'> Urgent</cat>" ) ]
16
- [ TestCase ( "cat !~ Urgent" , "<not><cat re='1'> Urgent</cat></not>" ) ]
17
- [ TestCase ( "cat = Urgent || cat = High" , "<or><cat>Urgent</cat><cat>High</cat></or>" ) ]
12
+ [ TestCase ( "cat=Urgent" , "<cat><![CDATA[ Urgent]]> </cat>" ) ]
13
+ [ TestCase ( "cat==Urgent" , "<cat><![CDATA[ Urgent]]> </cat>" ) ]
14
+ [ TestCase ( "cat!=Urgent" , "<not><cat><![CDATA[ Urgent]]> </cat></not>" ) ]
15
+ [ TestCase ( "cat =~ Urgent" , "<cat re=\" 1 \" ><![CDATA[ Urgent]]> </cat>" ) ]
16
+ [ TestCase ( "cat !~ Urgent" , "<not><cat re=\" 1 \" ><![CDATA[ Urgent]]> </cat></not>" ) ]
17
+ [ TestCase ( "cat = Urgent || cat = High" , "<or><cat><![CDATA[ Urgent]]> </cat><cat><![CDATA[ High]]> </cat></or>" ) ]
18
18
// Property Filter
19
- [ TestCase ( "Priority == High" , "<prop name=' Priority'> High</prop>" ) ]
20
- [ TestCase ( "Priority != Urgent" , "<not><prop name=' Priority'> Urgent</prop></not>" ) ]
21
- [ TestCase ( "Author =~ Jones" , "<prop name=' Author' re='1'> Jones</prop>" ) ]
22
- [ TestCase ( "Author !~ Jones" , "<not><prop name=' Author' re='1'> Jones</prop></not>" ) ]
19
+ [ TestCase ( "Priority == High" , "<prop name=\" Priority\" ><![CDATA[ High]]> </prop>" ) ]
20
+ [ TestCase ( "Priority != Urgent" , "<not><prop name=\" Priority\" ><![CDATA[ Urgent]]> </prop></not>" ) ]
21
+ [ TestCase ( "Author =~ Jones" , "<prop name=\" Author\" re=\" 1 \" ><![CDATA[ Jones]]> </prop>" ) ]
22
+ [ TestCase ( "Author !~ Jones" , "<not><prop name=\" Author\" re=\" 1 \" ><![CDATA[ Jones]]> </prop></not>" ) ]
23
23
// Name Filter
24
- [ TestCase ( "name='SomeTest'" , "<name>SomeTest</name>" ) ]
24
+ [ TestCase ( "name='SomeTest'" , "<name><![CDATA[ SomeTest]]> </name>" ) ]
25
25
// Method Filter
26
- [ TestCase ( "method=TestMethod" , "<method>TestMethod</method>" ) ]
27
- [ TestCase ( "method=Test1||method=Test2||method=Test3" , "<or><method>Test1</method><method>Test2</method><method>Test3</method></or>" ) ]
26
+ [ TestCase ( "method=TestMethod" , "<method><![CDATA[ TestMethod]]> </method>" ) ]
27
+ [ TestCase ( "method=Test1||method=Test2||method=Test3" , "<or><method><![CDATA[ Test1]]> </method><method><![CDATA[ Test2]]> </method><method><![CDATA[ Test3]]> </method></or>" ) ]
28
28
// Namespace Filter
29
- [ TestCase ( "namespace=Foo" , "<namespace>Foo</namespace>" ) ]
30
- [ TestCase ( "namespace=Foo.Bar" , "<namespace>Foo.Bar</namespace>" ) ]
31
- [ TestCase ( "namespace=Foo||namespace=Bar" , "<or><namespace>Foo</namespace><namespace>Bar</namespace></or>" ) ]
32
- [ TestCase ( "namespace=Foo.Bar||namespace=Bar.Baz" , "<or><namespace>Foo.Bar</namespace><namespace>Bar.Baz</namespace></or>" ) ]
29
+ [ TestCase ( "namespace=Foo" , "<namespace><![CDATA[ Foo]]> </namespace>" ) ]
30
+ [ TestCase ( "namespace=Foo.Bar" , "<namespace><![CDATA[ Foo.Bar]]> </namespace>" ) ]
31
+ [ TestCase ( "namespace=Foo||namespace=Bar" , "<or><namespace><![CDATA[ Foo]]> </namespace><namespace><![CDATA[ Bar]]> </namespace></or>" ) ]
32
+ [ TestCase ( "namespace=Foo.Bar||namespace=Bar.Baz" , "<or><namespace><![CDATA[ Foo.Bar]]> </namespace><namespace><![CDATA[ Bar.Baz]]> </namespace></or>" ) ]
33
33
// Test Filter
34
- [ TestCase ( "test='My.Test.Fixture.Method(42)'" , "<test>My.Test.Fixture.Method(42)</test>" ) ]
35
- [ TestCase ( "test='My.Test.Fixture.Method(\" xyz\" )'" , "<test>My.Test.Fixture.Method(" xyz") </test>" ) ]
36
- [ TestCase ( "test='My.Test.Fixture.Method(\" abc\\ 's\" )'" , "<test>My.Test.Fixture.Method(" abc's") </test>" ) ]
37
- [ TestCase ( "test='My.Test.Fixture.Method(\" x&y&z\" )'" , "<test>My.Test.Fixture.Method("x&y&z") </test>" ) ]
38
- [ TestCase ( "test='My.Test.Fixture.Method(\" <xyz>\" )'" , "<test>My.Test.Fixture.Method("< xyz>") </test>" ) ]
39
- [ TestCase ( "test == namespace.class(1).test1(1)" , "<test>namespace.class(1).test1(1)</test>" ) ]
40
- [ TestCase ( "test == \" namespace.class(1).test1(1)\" " , "<test>namespace.class(1).test1(1)</test>" ) ]
41
- [ TestCase ( "test == 'namespace.class(1).test1(1)'" , "<test>namespace.class(1).test1(1)</test>" ) ]
42
- [ TestCase ( "test =~ \" (namespace\\ .test1\\ (1\\ )|namespace\\ .test2\\ (2\\ ))\" " , "<test re='1'> (namespace.test1(1)|namespace.test2(2))</test>" ) ]
43
- [ TestCase ( "test =~ '(namespace\\ .test1\\ (1\\ )|namespace\\ .test2\\ (2\\ ))'" , "<test re='1'> (namespace.test1(1)|namespace.test2(2))</test>" ) ]
44
- [ TestCase ( "test =~ /(namespace\\ .test1\\ (1\\ )|namespace\\ .test2\\ (2\\ ))/" , "<test re='1'> (namespace.test1(1)|namespace.test2(2))</test>" ) ]
45
- [ TestCase ( "test =~ \" (namespace1|namespace2)\\ .test1\" " , "<test re='1'> (namespace1|namespace2).test1</test>" ) ]
46
- [ TestCase ( "test =~ '(namespace1|namespace2)\\ .test1'" , "<test re='1'> (namespace1|namespace2).test1</test>" ) ]
47
- [ TestCase ( "test =~ /(namespace1|namespace2)\\ .test1/" , "<test re='1'> (namespace1|namespace2).test1</test>" ) ]
48
- [ TestCase ( "test='My.Test.Fixture.Method(\" A \\ \\ \" B \\ \\ \" C \" )'" , "<test>My.Test.Fixture.Method(" A \\ " B \\ " C ") </test>" ) ]
34
+ [ TestCase ( "test='My.Test.Fixture.Method(42)'" , "<test><![CDATA[ My.Test.Fixture.Method(42)]]> </test>" ) ]
35
+ [ TestCase ( "test='My.Test.Fixture.Method(\" xyz\" )'" , "<test><![CDATA[ My.Test.Fixture.Method(\" xyz\" )]]> </test>" ) ]
36
+ [ TestCase ( "test='My.Test.Fixture.Method(\" abc\\ 's\" )'" , "<test><![CDATA[ My.Test.Fixture.Method(\" abc's \" )]]> </test>" ) ]
37
+ [ TestCase ( "test='My.Test.Fixture.Method(\" x&y&z\" )'" , "<test><![CDATA[ My.Test.Fixture.Method(\" x&y&z \" )]]> </test>" ) ]
38
+ [ TestCase ( "test='My.Test.Fixture.Method(\" <xyz>\" )'" , "<test><![CDATA[ My.Test.Fixture.Method(\" < xyz> \" )]]> </test>" ) ]
39
+ [ TestCase ( "test == namespace.class(1).test1(1)" , "<test><![CDATA[ namespace.class(1).test1(1)]]> </test>" ) ]
40
+ [ TestCase ( "test == \" namespace.class(1).test1(1)\" " , "<test><![CDATA[ namespace.class(1).test1(1)]]> </test>" ) ]
41
+ [ TestCase ( "test == 'namespace.class(1).test1(1)'" , "<test><![CDATA[ namespace.class(1).test1(1)]]> </test>" ) ]
42
+ [ TestCase ( "test =~ \" (namespace\\ .test1\\ (1\\ )|namespace\\ .test2\\ (2\\ ))\" " , "<test re=\" 1 \" ><![CDATA[ (namespace.test1(1)|namespace.test2(2))]]> </test>" ) ]
43
+ [ TestCase ( "test =~ '(namespace\\ .test1\\ (1\\ )|namespace\\ .test2\\ (2\\ ))'" , "<test re=\" 1 \" ><![CDATA[ (namespace.test1(1)|namespace.test2(2))]]> </test>" ) ]
44
+ [ TestCase ( "test =~ /(namespace\\ .test1\\ (1\\ )|namespace\\ .test2\\ (2\\ ))/" , "<test re=\" 1 \" ><![CDATA[ (namespace.test1(1)|namespace.test2(2))]]> </test>" ) ]
45
+ [ TestCase ( "test =~ \" (namespace1|namespace2)\\ .test1\" " , "<test re=\" 1 \" ><![CDATA[ (namespace1|namespace2).test1]]> </test>" ) ]
46
+ [ TestCase ( "test =~ '(namespace1|namespace2)\\ .test1'" , "<test re=\" 1 \" ><![CDATA[ (namespace1|namespace2).test1]]> </test>" ) ]
47
+ [ TestCase ( "test =~ /(namespace1|namespace2)\\ .test1/" , "<test re=\" 1 \" ><![CDATA[ (namespace1|namespace2).test1]]> </test>" ) ]
48
+ [ TestCase ( "test='My.Test.Fixture.Method(\" A \\ \\ \" B \\ \\ \" C \" )'" , "<test><![CDATA[ My.Test.Fixture.Method(\" A \\ \" B \\ \" C \" )]]> </test>" ) ]
49
49
// And Filter
50
- [ TestCase ( "cat==Urgent && test=='My.Tests'" , "<and><cat>Urgent</cat><test>My.Tests</test></and>" ) ]
51
- [ TestCase ( "cat==Urgent and test=='My.Tests'" , "<and><cat>Urgent</cat><test>My.Tests</test></and>" ) ]
50
+ [ TestCase ( "cat==Urgent && test=='My.Tests'" , "<and><cat><![CDATA[ Urgent]]> </cat><test><![CDATA[ My.Tests]]> </test></and>" ) ]
51
+ [ TestCase ( "cat==Urgent and test=='My.Tests'" , "<and><cat><![CDATA[ Urgent]]> </cat><test><![CDATA[ My.Tests]]> </test></and>" ) ]
52
52
// Or Filter
53
- [ TestCase ( "cat==Urgent || test=='My.Tests'" , "<or><cat>Urgent</cat><test>My.Tests</test></or>" ) ]
54
- [ TestCase ( "cat==Urgent or test=='My.Tests'" , "<or><cat>Urgent</cat><test>My.Tests</test></or>" ) ]
53
+ [ TestCase ( "cat==Urgent || test=='My.Tests'" , "<or><cat><![CDATA[ Urgent]]> </cat><test><![CDATA[ My.Tests]]> </test></or>" ) ]
54
+ [ TestCase ( "cat==Urgent or test=='My.Tests'" , "<or><cat><![CDATA[ Urgent]]> </cat><test><![CDATA[ My.Tests]]> </test></or>" ) ]
55
55
// Mixed And Filter with Or Filter
56
- [ TestCase ( "cat==Urgent || test=='My.Tests' && cat == high" , "<or><cat>Urgent</cat><and><test>My.Tests</test><cat>high</cat></and></or>" ) ]
57
- [ TestCase ( "cat==Urgent && test=='My.Tests' || cat == high" , "<or><and><cat>Urgent</cat><test>My.Tests</test></and><cat>high</cat></or>" ) ]
58
- [ TestCase ( "cat==Urgent && (test=='My.Tests' || cat == high)" , "<and><cat>Urgent</cat><or><test>My.Tests</test><cat>high</cat></or></and>" ) ]
59
- [ TestCase ( "cat==Urgent && !(test=='My.Tests' || cat == high)" , "<and><cat>Urgent</cat><not><or><test>My.Tests</test><cat>high</cat></or></not></and>" ) ]
56
+ [ TestCase ( "cat==Urgent || test=='My.Tests' && cat == high" , "<or><cat><![CDATA[ Urgent]]> </cat><and><test><![CDATA[ My.Tests]]> </test><cat><![CDATA[ high]]> </cat></and></or>" ) ]
57
+ [ TestCase ( "cat==Urgent && test=='My.Tests' || cat == high" , "<or><and><cat><![CDATA[ Urgent]]> </cat><test><![CDATA[ My.Tests]]> </test></and><cat><![CDATA[ high]]> </cat></or>" ) ]
58
+ [ TestCase ( "cat==Urgent && (test=='My.Tests' || cat == high)" , "<and><cat><![CDATA[ Urgent]]> </cat><or><test><![CDATA[ My.Tests]]> </test><cat><![CDATA[ high]]> </cat></or></and>" ) ]
59
+ [ TestCase ( "cat==Urgent && !(test=='My.Tests' || cat == high)" , "<and><cat><![CDATA[ Urgent]]> </cat><not><or><test><![CDATA[ My.Tests]]> </test><cat><![CDATA[ high]]> </cat></or></not></and>" ) ]
60
60
// Not Filter
61
- [ TestCase ( "!(test!='My.Tests')" , "<not><not><test>My.Tests</test></not></not>" ) ]
62
- [ TestCase ( "!(cat!=Urgent)" , "<not><not><cat>Urgent</cat></not></not>" ) ]
61
+ [ TestCase ( "!(test!='My.Tests')" , "<not><not><test><![CDATA[ My.Tests]]> </test></not></not>" ) ]
62
+ [ TestCase ( "!(cat!=Urgent)" , "<not><not><cat><![CDATA[ Urgent]]> </cat></not></not>" ) ]
63
63
public void TestParser ( string input , string output )
64
64
{
65
65
Assert . That ( TestSelectionParser . Parse ( input ) , Is . EqualTo ( output ) ) ;
0 commit comments