]> git.saurik.com Git - wxWidgets.git/blob - tests/misc/pathlist.cpp
9c8c1453973d3db59fe163d22aadd64e0477171a
[wxWidgets.git] / tests / misc / pathlist.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/misc/pathlist.cpp
3 // Purpose: Test wxPathList
4 // Author: Francesco Montorsi (extracted from console sample)
5 // Created: 2010-06-02
6 // Copyright: (c) 2010 wxWidgets team
7 ///////////////////////////////////////////////////////////////////////////////
8
9 // ----------------------------------------------------------------------------
10 // headers
11 // ----------------------------------------------------------------------------
12
13 #include "testprec.h"
14
15 #ifdef __BORLANDC__
16 # pragma hdrstop
17 #endif
18
19 #include "wx/filefn.h"
20
21 // ----------------------------------------------------------------------------
22 // test class
23 // ----------------------------------------------------------------------------
24
25 class PathListTestCase : public CppUnit::TestCase
26 {
27 public:
28 PathListTestCase() { }
29
30 private:
31 CPPUNIT_TEST_SUITE( PathListTestCase );
32 CPPUNIT_TEST( FindValidPath );
33 CPPUNIT_TEST_SUITE_END();
34
35 void FindValidPath();
36
37 DECLARE_NO_COPY_CLASS(PathListTestCase)
38 };
39
40 // register in the unnamed registry so that these tests are run by default
41 CPPUNIT_TEST_SUITE_REGISTRATION( PathListTestCase );
42
43 // also include in its own registry so that these tests can be run alone
44 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( PathListTestCase, "PathListTestCase" );
45
46 void PathListTestCase::FindValidPath()
47 {
48 #ifdef __UNIX__
49 #define CMD_IN_PATH wxT("ls")
50 #else
51 #define CMD_IN_PATH wxT("cmd.exe")
52 #endif
53
54 wxPathList pathlist;
55 pathlist.AddEnvList(wxT("PATH"));
56
57 wxString path = pathlist.FindValidPath(CMD_IN_PATH);
58 CPPUNIT_ASSERT( !path.empty() );
59 }
60
61