@@ -36,28 +36,29 @@ class TestOptions: public TestFixture {
3636 TEST_CASE (help);
3737 TEST_CASE (help_long);
3838 TEST_CASE (multiple_testcases);
39+ TEST_CASE (multiple_testcases_ignore_duplicates);
3940 TEST_CASE (invalid_switches);
4041 }
4142
4243
4344 void which_test () const {
4445 const char * argv[] = {" ./test_runner" , " TestClass" };
4546 options args (sizeof argv / sizeof argv[0 ], argv);
46- ASSERT_EQUALS ( " TestClass" , args.which_test ());
47+ ASSERT (std::set<std::string> { " TestClass" } == args.which_test ());
4748 }
4849
4950
5051 void which_test_method () const {
5152 const char * argv[] = {" ./test_runner" , " TestClass::TestMethod" };
5253 options args (sizeof argv / sizeof argv[0 ], argv);
53- ASSERT_EQUALS ( " TestClass::TestMethod" , args.which_test ());
54+ ASSERT (std::set<std::string> { " TestClass::TestMethod" } == args.which_test ());
5455 }
5556
5657
5758 void no_test_method () const {
5859 const char * argv[] = {" ./test_runner" };
5960 options args (sizeof argv / sizeof argv[0 ], argv);
60- ASSERT_EQUALS ( " " , args.which_test ());
61+ ASSERT (std::set<std::string> { " " } == args.which_test ());
6162 }
6263
6364
@@ -95,16 +96,24 @@ class TestOptions: public TestFixture {
9596 }
9697
9798 void multiple_testcases () const {
98- const char * argv[] = {" ./test_runner" , " TestClass::TestMethod" , " Ignore::ThisOne " };
99+ const char * argv[] = {" ./test_runner" , " TestClass::TestMethod" , " TestClass::AnotherTestMethod " };
99100 options args (sizeof argv / sizeof argv[0 ], argv);
100- ASSERT_EQUALS (" TestClass::TestMethod" , args.which_test ());
101+ std::set<std::string> expected {" TestClass::TestMethod" , " TestClass::AnotherTestMethod" };
102+ ASSERT (expected == args.which_test ());
101103 }
102104
105+ void multiple_testcases_ignore_duplicates () const {
106+ const char * argv[] = {" ./test_runner" , " TestClass::TestMethod" , " TestClass" };
107+ options args (sizeof argv / sizeof argv[0 ], argv);
108+ std::set<std::string> expected {" TestClass" };
109+ ASSERT (expected == args.which_test ());
110+ }
103111
104112 void invalid_switches () const {
105113 const char * argv[] = {" ./test_runner" , " TestClass::TestMethod" , " -a" , " -v" , " -q" };
106114 options args (sizeof argv / sizeof argv[0 ], argv);
107- ASSERT_EQUALS (" TestClass::TestMethod" , args.which_test ());
115+ std::set<std::string> expected {" TestClass::TestMethod" };
116+ ASSERT (expected == args.which_test ());
108117 ASSERT_EQUALS (true , args.quiet ());
109118 }
110119};
0 commit comments