Fresco/Fresco-Test/syunit-c++/src TestCmd.cc,1.3,1.4

Nathaniel Smith <[email protected]> Tue, 09 Mar 2004 23:42:08 +0000
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Fresco-Test/syunit-c++/src
In directory frida:/tmp/cvs-serv31567

Modified Files:
	TestCmd.cc 
Log Message:
Don't crash if user tries to run non-existent test.  (Fixes bug290.)
(Originally committed to old repository.)


Index: TestCmd.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Fresco-Test/syunit-c++/src/TestCmd.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- TestCmd.cc	20 May 2003 09:06:27 -0000	1.3
+++ TestCmd.cc	9 Mar 2004 23:42:04 -0000	1.4
@@ -98,7 +98,16 @@
           }
           else
           {
-              std::cout << my_tests[my_test_name]->run();
+              if (my_tests.find(my_test_name) != my_tests.end())
+              {
+                  std::cout << my_tests[my_test_name]->run();
+              }
+              else
+              {
+                  std::cerr << "No such test '" << my_test_name
+                            << "'" << std::endl;
+                  std::exit(2);
+              }
           }
           
       }