test.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: test.cpp
  3. // Purpose: Test program for wxWidgets
  4. // Author: Mike Wetherell
  5. // Copyright: (c) 2004 Mike Wetherell
  6. // Licence: wxWindows licence
  7. ///////////////////////////////////////////////////////////////////////////////
  8. // ----------------------------------------------------------------------------
  9. // headers
  10. // ----------------------------------------------------------------------------
  11. // For compilers that support precompilation, includes "wx/wx.h"
  12. // and "wx/cppunit.h"
  13. #include "testprec.h"
  14. #ifdef __BORLANDC__
  15. #pragma hdrstop
  16. #endif
  17. // for all others, include the necessary headers
  18. #ifndef WX_PRECOMP
  19. #include "wx/wx.h"
  20. #endif
  21. #include "wx/beforestd.h"
  22. #ifdef __VISUALC__
  23. #pragma warning(disable:4100)
  24. #endif
  25. #include <cppunit/TestListener.h>
  26. #include <cppunit/Protector.h>
  27. #include <cppunit/Test.h>
  28. #include <cppunit/TestResult.h>
  29. #include <cppunit/TestFailure.h>
  30. #include <cppunit/TestResultCollector.h>
  31. #ifdef __VISUALC__
  32. #pragma warning(default:4100)
  33. #endif
  34. #include "wx/afterstd.h"
  35. #include "wx/cmdline.h"
  36. #include <exception>
  37. #include <iostream>
  38. #ifdef __WINDOWS__
  39. #include "wx/msw/msvcrt.h"
  40. #endif
  41. #ifdef __WXOSX__
  42. #include "wx/osx/private.h"
  43. #endif
  44. #if wxUSE_GUI
  45. #include "testableframe.h"
  46. #endif
  47. #include "wx/socket.h"
  48. #include "wx/evtloop.h"
  49. using namespace std;
  50. using CppUnit::Test;
  51. using CppUnit::TestSuite;
  52. using CppUnit::TestFactoryRegistry;
  53. // ----------------------------------------------------------------------------
  54. // helper classes
  55. // ----------------------------------------------------------------------------
  56. // exception class for MSVC debug CRT assertion failures
  57. #ifdef wxUSE_VC_CRTDBG
  58. struct CrtAssertFailure
  59. {
  60. CrtAssertFailure(const char *message) : m_msg(message) { }
  61. const wxString m_msg;
  62. wxDECLARE_NO_ASSIGN_CLASS(CrtAssertFailure);
  63. };
  64. #endif // wxUSE_VC_CRTDBG
  65. #if wxDEBUG_LEVEL
  66. // Information about the last not yet handled assertion.
  67. static wxString s_lastAssertMessage;
  68. static wxString FormatAssertMessage(const wxString& file,
  69. int line,
  70. const wxString& func,
  71. const wxString& cond,
  72. const wxString& msg)
  73. {
  74. wxString str;
  75. str << "wxWidgets assert: " << cond << " failed "
  76. "at " << file << ":" << line << " in " << func
  77. << " with message '" << msg << "'";
  78. return str;
  79. }
  80. static void TestAssertHandler(const wxString& file,
  81. int line,
  82. const wxString& func,
  83. const wxString& cond,
  84. const wxString& msg)
  85. {
  86. // Determine whether we can safely throw an exception to just make the test
  87. // fail or whether we need to abort (in this case "msg" will contain the
  88. // explanation why did we decide to do it).
  89. wxString abortReason;
  90. const wxString
  91. assertMessage = FormatAssertMessage(file, line, func, cond, msg);
  92. if ( !wxIsMainThread() )
  93. {
  94. // Exceptions thrown from worker threads are not caught currently and
  95. // so we'd just die without any useful information -- abort instead.
  96. abortReason << assertMessage << "in a worker thread.";
  97. }
  98. else if ( uncaught_exception() )
  99. {
  100. // Throwing while already handling an exception would result in
  101. // terminate() being called and we wouldn't get any useful information
  102. // about why the test failed then.
  103. if ( s_lastAssertMessage.empty() )
  104. {
  105. abortReason << assertMessage << "while handling an exception";
  106. }
  107. else // In this case the exception is due to a previous assert.
  108. {
  109. abortReason << s_lastAssertMessage << "\n and another "
  110. << assertMessage << " while handling it.";
  111. }
  112. }
  113. else // Can "safely" throw from here.
  114. {
  115. // Remember this in case another assert happens while handling this
  116. // exception: we want to show the original assert as it's usually more
  117. // useful to determine the real root of the problem.
  118. s_lastAssertMessage = assertMessage;
  119. throw TestAssertFailure(file, line, func, cond, msg);
  120. }
  121. wxFputs(abortReason, stderr);
  122. fflush(stderr);
  123. _exit(-1);
  124. }
  125. #endif // wxDEBUG_LEVEL
  126. // this function should only be called from a catch clause
  127. static string GetExceptionMessage()
  128. {
  129. wxString msg;
  130. try
  131. {
  132. throw;
  133. }
  134. #if wxDEBUG_LEVEL
  135. catch ( TestAssertFailure& )
  136. {
  137. msg = s_lastAssertMessage;
  138. s_lastAssertMessage.clear();
  139. }
  140. #endif // wxDEBUG_LEVEL
  141. #ifdef wxUSE_VC_CRTDBG
  142. catch ( CrtAssertFailure& e )
  143. {
  144. msg << "CRT assert failure: " << e.m_msg;
  145. }
  146. #endif // wxUSE_VC_CRTDBG
  147. catch ( std::exception& e )
  148. {
  149. msg << "std::exception: " << e.what();
  150. }
  151. catch ( ... )
  152. {
  153. msg = "Unknown exception caught.";
  154. }
  155. return string(msg.mb_str());
  156. }
  157. // Protector adding handling of wx-specific (this includes MSVC debug CRT in
  158. // this context) exceptions
  159. class wxUnitTestProtector : public CppUnit::Protector
  160. {
  161. public:
  162. virtual bool protect(const CppUnit::Functor &functor,
  163. const CppUnit::ProtectorContext& context)
  164. {
  165. try
  166. {
  167. return functor();
  168. }
  169. catch ( std::exception& )
  170. {
  171. // cppunit deals with the standard exceptions itself, let it do as
  172. // it output more details (especially for std::exception-derived
  173. // CppUnit::Exception) than we do
  174. throw;
  175. }
  176. catch ( ... )
  177. {
  178. reportError(context, CppUnit::Message("Uncaught exception",
  179. GetExceptionMessage()));
  180. }
  181. return false;
  182. }
  183. };
  184. // Displays the test name before starting to execute it: this helps with
  185. // diagnosing where exactly does a test crash or hang when/if it does.
  186. class DetailListener : public CppUnit::TestListener
  187. {
  188. public:
  189. DetailListener(bool doTiming = false):
  190. CppUnit::TestListener(),
  191. m_timing(doTiming)
  192. {
  193. }
  194. virtual void startTest(CppUnit::Test *test)
  195. {
  196. printf(" %-60s ", test->getName().c_str());
  197. m_result = RESULT_OK;
  198. m_watch.Start();
  199. }
  200. virtual void addFailure(const CppUnit::TestFailure& failure)
  201. {
  202. m_result = failure.isError() ? RESULT_ERROR : RESULT_FAIL;
  203. }
  204. virtual void endTest(CppUnit::Test * WXUNUSED(test))
  205. {
  206. m_watch.Pause();
  207. printf("%s", GetResultStr(m_result));
  208. if (m_timing)
  209. printf(" %6ld ms", m_watch.Time());
  210. printf("\n");
  211. }
  212. protected :
  213. enum ResultType
  214. {
  215. RESULT_OK = 0,
  216. RESULT_FAIL,
  217. RESULT_ERROR,
  218. RESULT_MAX
  219. };
  220. const char* GetResultStr(ResultType type) const
  221. {
  222. static const char *resultTypeNames[] =
  223. {
  224. " OK",
  225. "FAIL",
  226. " ERR"
  227. };
  228. wxCOMPILE_TIME_ASSERT( WXSIZEOF(resultTypeNames) == RESULT_MAX,
  229. ResultTypeNamesMismatch );
  230. return resultTypeNames[type];
  231. }
  232. bool m_timing;
  233. wxStopWatch m_watch;
  234. ResultType m_result;
  235. };
  236. #if wxUSE_GUI
  237. typedef wxApp TestAppBase;
  238. #else
  239. typedef wxAppConsole TestAppBase;
  240. #endif
  241. // The application class
  242. //
  243. class TestApp : public TestAppBase
  244. {
  245. public:
  246. TestApp();
  247. // standard overrides
  248. virtual void OnInitCmdLine(wxCmdLineParser& parser);
  249. virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
  250. virtual bool OnInit();
  251. virtual int OnExit();
  252. // used by events propagation test
  253. virtual int FilterEvent(wxEvent& event);
  254. virtual bool ProcessEvent(wxEvent& event);
  255. void SetFilterEventFunc(FilterEventFunc f) { m_filterEventFunc = f; }
  256. void SetProcessEventFunc(ProcessEventFunc f) { m_processEventFunc = f; }
  257. // In console applications we run the tests directly from the overridden
  258. // OnRun(), but in the GUI ones we run them when we get the first call to
  259. // our EVT_IDLE handler to ensure that we do everything from inside the
  260. // main event loop. This is especially important under wxOSX/Cocoa where
  261. // the main event loop is different from the others but it's also safer to
  262. // do it like this in the other ports as we test the GUI code in the same
  263. // context as it's used usually, in normal programs, and it might behave
  264. // differently without the event loop.
  265. #if wxUSE_GUI
  266. void OnIdle(wxIdleEvent& event)
  267. {
  268. if ( m_runTests )
  269. {
  270. m_runTests = false;
  271. #ifdef __WXOSX__
  272. // we need to wait until the window is activated and fully ready
  273. // otherwise no events can be posted
  274. wxEventLoopBase* const loop = wxEventLoop::GetActive();
  275. if ( loop )
  276. {
  277. loop->DispatchTimeout(1000);
  278. loop->Yield();
  279. }
  280. #endif // __WXOSX__
  281. m_exitcode = RunTests();
  282. ExitMainLoop();
  283. }
  284. event.Skip();
  285. }
  286. #else // !wxUSE_GUI
  287. virtual int OnRun()
  288. {
  289. m_exitcode = RunTests();
  290. return m_exitcode;
  291. }
  292. #endif // wxUSE_GUI/!wxUSE_GUI
  293. private:
  294. void List(Test *test, const string& parent = "") const;
  295. // call List() if m_list or runner.addTest() otherwise
  296. void AddTest(CppUnit::TestRunner& runner, Test *test)
  297. {
  298. if (m_list)
  299. List(test);
  300. else
  301. runner.addTest(test);
  302. }
  303. int RunTests();
  304. // flag telling us whether we should run tests from our EVT_IDLE handler
  305. bool m_runTests;
  306. // command lines options/parameters
  307. bool m_list;
  308. bool m_longlist;
  309. bool m_detail;
  310. bool m_timing;
  311. wxArrayString m_registries;
  312. wxLocale *m_locale;
  313. // event handling hooks
  314. FilterEventFunc m_filterEventFunc;
  315. ProcessEventFunc m_processEventFunc;
  316. // the program exit code
  317. int m_exitcode;
  318. };
  319. IMPLEMENT_APP_NO_MAIN(TestApp)
  320. // ----------------------------------------------------------------------------
  321. // global functions
  322. // ----------------------------------------------------------------------------
  323. #ifdef wxUSE_VC_CRTDBG
  324. static int TestCrtReportHook(int reportType, char *message, int *)
  325. {
  326. if ( reportType != _CRT_ASSERT )
  327. return FALSE;
  328. throw CrtAssertFailure(message);
  329. }
  330. #endif // wxUSE_VC_CRTDBG
  331. int main(int argc, char **argv)
  332. {
  333. // tests can be ran non-interactively so make sure we don't show any assert
  334. // dialog boxes -- neither our own nor from MSVC debug CRT -- which would
  335. // prevent them from completing
  336. #if wxDEBUG_LEVEL
  337. wxSetAssertHandler(TestAssertHandler);
  338. #endif // wxDEBUG_LEVEL
  339. #ifdef wxUSE_VC_CRTDBG
  340. _CrtSetReportHook(TestCrtReportHook);
  341. #endif // wxUSE_VC_CRTDBG
  342. try
  343. {
  344. return wxEntry(argc, argv);
  345. }
  346. catch ( ... )
  347. {
  348. cerr << "\n" << GetExceptionMessage() << endl;
  349. }
  350. return -1;
  351. }
  352. extern void SetFilterEventFunc(FilterEventFunc func)
  353. {
  354. wxGetApp().SetFilterEventFunc(func);
  355. }
  356. extern void SetProcessEventFunc(ProcessEventFunc func)
  357. {
  358. wxGetApp().SetProcessEventFunc(func);
  359. }
  360. extern bool IsNetworkAvailable()
  361. {
  362. // NOTE: we could use wxDialUpManager here if it was in wxNet; since it's in
  363. // wxCore we use a simple rough test:
  364. wxSocketBase::Initialize();
  365. wxIPV4address addr;
  366. if (!addr.Hostname("www.google.com") || !addr.Service("www"))
  367. {
  368. wxSocketBase::Shutdown();
  369. return false;
  370. }
  371. wxSocketClient sock;
  372. sock.SetTimeout(10); // 10 secs
  373. bool online = sock.Connect(addr);
  374. wxSocketBase::Shutdown();
  375. return online;
  376. }
  377. extern bool IsAutomaticTest()
  378. {
  379. static int s_isAutomatic = -1;
  380. if ( s_isAutomatic == -1 )
  381. {
  382. // Allow setting an environment variable to emulate buildslave user for
  383. // testing.
  384. wxString username;
  385. if ( !wxGetEnv("WX_TEST_USER", &username) )
  386. username = wxGetUserId();
  387. username.MakeLower();
  388. s_isAutomatic = username.Matches("buildslave*") ||
  389. username.Matches("sandbox*");
  390. }
  391. return s_isAutomatic == 1;
  392. }
  393. // helper of RunTests(): gets the test with the given name, returning NULL (and
  394. // not an empty test suite) if there is no such test
  395. static Test *GetTestByName(const wxString& name)
  396. {
  397. Test *
  398. test = TestFactoryRegistry::getRegistry(string(name.mb_str())).makeTest();
  399. if ( test )
  400. {
  401. TestSuite * const suite = dynamic_cast<TestSuite *>(test);
  402. if ( !suite || !suite->countTestCases() )
  403. {
  404. // it's a bogus test, don't use it
  405. delete test;
  406. test = NULL;
  407. }
  408. }
  409. return test;
  410. }
  411. // ----------------------------------------------------------------------------
  412. // TestApp
  413. // ----------------------------------------------------------------------------
  414. TestApp::TestApp()
  415. : m_list(false),
  416. m_longlist(false)
  417. {
  418. m_runTests = true;
  419. m_filterEventFunc = NULL;
  420. m_processEventFunc = NULL;
  421. m_locale = NULL;
  422. m_exitcode = EXIT_SUCCESS;
  423. }
  424. // Init
  425. //
  426. bool TestApp::OnInit()
  427. {
  428. if ( !TestAppBase::OnInit() )
  429. return false;
  430. #if wxUSE_GUI
  431. cout << "Test program for wxWidgets GUI features\n"
  432. #else
  433. cout << "Test program for wxWidgets non-GUI features\n"
  434. #endif
  435. << "build: " << WX_BUILD_OPTIONS_SIGNATURE << "\n"
  436. << "running under " << wxGetOsDescription()
  437. << " as " << wxGetUserId() << std::endl;
  438. if ( m_detail )
  439. {
  440. // Output some important information about the test environment.
  441. cout << "Running under " << wxGetOsDescription() << ", "
  442. "locale is " << setlocale(LC_ALL, NULL) << std::endl;
  443. }
  444. #if wxUSE_GUI
  445. // create a hidden parent window to be used as parent for the GUI controls
  446. wxTestableFrame* frame = new wxTestableFrame();
  447. frame->Show();
  448. Connect(wxEVT_IDLE, wxIdleEventHandler(TestApp::OnIdle));
  449. #endif // wxUSE_GUI
  450. return true;
  451. }
  452. // The table of command line options
  453. //
  454. void TestApp::OnInitCmdLine(wxCmdLineParser& parser)
  455. {
  456. TestAppBase::OnInitCmdLine(parser);
  457. static const wxCmdLineEntryDesc cmdLineDesc[] = {
  458. { wxCMD_LINE_SWITCH, "l", "list",
  459. "list the test suites, do not run them",
  460. wxCMD_LINE_VAL_NONE, 0 },
  461. { wxCMD_LINE_SWITCH, "L", "longlist",
  462. "list the test cases, do not run them",
  463. wxCMD_LINE_VAL_NONE, 0 },
  464. { wxCMD_LINE_SWITCH, "d", "detail",
  465. "print the test case names, run them",
  466. wxCMD_LINE_VAL_NONE, 0 },
  467. { wxCMD_LINE_SWITCH, "t", "timing",
  468. "print names and measure running time of individual test, run them",
  469. wxCMD_LINE_VAL_NONE, 0 },
  470. { wxCMD_LINE_OPTION, "", "locale",
  471. "locale to use when running the program",
  472. wxCMD_LINE_VAL_STRING, 0 },
  473. { wxCMD_LINE_PARAM, NULL, NULL, "REGISTRY", wxCMD_LINE_VAL_STRING,
  474. wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE },
  475. wxCMD_LINE_DESC_END
  476. };
  477. parser.SetDesc(cmdLineDesc);
  478. }
  479. // Handle command line options
  480. //
  481. bool TestApp::OnCmdLineParsed(wxCmdLineParser& parser)
  482. {
  483. if (parser.GetParamCount())
  484. {
  485. for (size_t i = 0; i < parser.GetParamCount(); i++)
  486. m_registries.push_back(parser.GetParam(i));
  487. }
  488. m_longlist = parser.Found("longlist");
  489. m_list = m_longlist || parser.Found("list");
  490. m_timing = parser.Found("timing");
  491. m_detail = !m_timing && parser.Found("detail");
  492. wxString loc;
  493. if ( parser.Found("locale", &loc) )
  494. {
  495. const wxLanguageInfo * const info = wxLocale::FindLanguageInfo(loc);
  496. if ( !info )
  497. {
  498. cerr << "Locale \"" << string(loc.mb_str()) << "\" is unknown.\n";
  499. return false;
  500. }
  501. m_locale = new wxLocale(info->Language);
  502. if ( !m_locale->IsOk() )
  503. {
  504. cerr << "Using locale \"" << string(loc.mb_str()) << "\" failed.\n";
  505. return false;
  506. }
  507. }
  508. return TestAppBase::OnCmdLineParsed(parser);
  509. }
  510. // Event handling
  511. int TestApp::FilterEvent(wxEvent& event)
  512. {
  513. if ( m_filterEventFunc )
  514. return (*m_filterEventFunc)(event);
  515. return TestAppBase::FilterEvent(event);
  516. }
  517. bool TestApp::ProcessEvent(wxEvent& event)
  518. {
  519. if ( m_processEventFunc )
  520. return (*m_processEventFunc)(event);
  521. return TestAppBase::ProcessEvent(event);
  522. }
  523. // Run
  524. //
  525. int TestApp::RunTests()
  526. {
  527. #if wxUSE_LOG
  528. // Switch off logging unless --verbose
  529. bool verbose = wxLog::GetVerbose();
  530. wxLog::EnableLogging(verbose);
  531. #else
  532. bool verbose = false;
  533. #endif
  534. CppUnit::TextTestRunner runner;
  535. if ( m_registries.empty() )
  536. {
  537. // run or list all tests which use the CPPUNIT_TEST_SUITE_REGISTRATION() macro
  538. // (i.e. those registered in the "All tests" registry); if there are other
  539. // tests not registered with the CPPUNIT_TEST_SUITE_REGISTRATION() macro
  540. // then they won't be listed/run!
  541. AddTest(runner, TestFactoryRegistry::getRegistry().makeTest());
  542. if (m_list)
  543. {
  544. cout << "\nNote that the list above is not complete as it doesn't include the \n";
  545. cout << "tests disabled by default.\n";
  546. }
  547. }
  548. else // run only the selected tests
  549. {
  550. for (size_t i = 0; i < m_registries.size(); i++)
  551. {
  552. const wxString reg = m_registries[i];
  553. Test *test = GetTestByName(reg);
  554. if ( !test && !reg.EndsWith("TestCase") )
  555. {
  556. test = GetTestByName(reg + "TestCase");
  557. }
  558. if ( !test )
  559. {
  560. cerr << "No such test suite: " << string(reg.mb_str()) << endl;
  561. return 2;
  562. }
  563. AddTest(runner, test);
  564. }
  565. }
  566. if ( m_list )
  567. return EXIT_SUCCESS;
  568. runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), cout));
  569. // there is a bug
  570. // (http://sf.net/tracker/index.php?func=detail&aid=1649369&group_id=11795&atid=111795)
  571. // in some versions of cppunit: they write progress dots to cout (and not
  572. // cerr) and don't flush it so all the dots appear at once at the end which
  573. // is not very useful so unbuffer cout to work around this
  574. cout.setf(ios::unitbuf);
  575. // add detail listener if needed
  576. DetailListener detailListener(m_timing);
  577. if ( m_detail || m_timing )
  578. runner.eventManager().addListener(&detailListener);
  579. // finally ensure that we report our own exceptions nicely instead of
  580. // giving "uncaught exception of unknown type" messages
  581. runner.eventManager().pushProtector(new wxUnitTestProtector);
  582. bool printProgress = !(verbose || m_detail || m_timing);
  583. runner.run("", false, true, printProgress);
  584. return runner.result().testFailures() == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
  585. }
  586. int TestApp::OnExit()
  587. {
  588. delete m_locale;
  589. #if wxUSE_GUI
  590. delete GetTopWindow();
  591. #endif // wxUSE_GUI
  592. return m_exitcode;
  593. }
  594. // List the tests
  595. //
  596. void TestApp::List(Test *test, const string& parent /*=""*/) const
  597. {
  598. TestSuite *suite = dynamic_cast<TestSuite*>(test);
  599. string name;
  600. if (suite) {
  601. // take the last component of the name and append to the parent
  602. name = test->getName();
  603. string::size_type i = name.find_last_of(".:");
  604. if (i != string::npos)
  605. name = name.substr(i + 1);
  606. name = parent + "." + name;
  607. // drop the 1st component from the display and indent
  608. if (parent != "") {
  609. string::size_type j = i = name.find('.', 1);
  610. while ((j = name.find('.', j + 1)) != string::npos)
  611. cout << " ";
  612. cout << " " << name.substr(i + 1) << "\n";
  613. }
  614. typedef vector<Test*> Tests;
  615. typedef Tests::const_iterator Iter;
  616. const Tests& tests = suite->getTests();
  617. for (Iter it = tests.begin(); it != tests.end(); ++it)
  618. List(*it, name);
  619. }
  620. else if (m_longlist) {
  621. string::size_type i = 0;
  622. while ((i = parent.find('.', i + 1)) != string::npos)
  623. cout << " ";
  624. cout << " " << test->getName() << "\n";
  625. }
  626. }