]>
git.saurik.com Git - wxWidgets.git/blob - tests/misc/pathlist.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/misc/pathlist.cpp
3 // Purpose: Test wxPathList
4 // Author: Francesco Montorsi (extracted from console sample)
6 // Copyright: (c) 2010 wxWidgets team
7 ///////////////////////////////////////////////////////////////////////////////
9 // ----------------------------------------------------------------------------
11 // ----------------------------------------------------------------------------
19 #include "wx/filefn.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 class PathListTestCase
: public CppUnit::TestCase
28 PathListTestCase() { }
31 CPPUNIT_TEST_SUITE( PathListTestCase
);
32 CPPUNIT_TEST( FindValidPath
);
33 CPPUNIT_TEST_SUITE_END();
37 DECLARE_NO_COPY_CLASS(PathListTestCase
)
40 // register in the unnamed registry so that these tests are run by default
41 CPPUNIT_TEST_SUITE_REGISTRATION( PathListTestCase
);
43 // also include in its own registry so that these tests can be run alone
44 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( PathListTestCase
, "PathListTestCase" );
46 void PathListTestCase::FindValidPath()
49 #define CMD_IN_PATH wxT("ls")
51 #define CMD_IN_PATH wxT("cmd.exe")
55 pathlist
.AddEnvList(wxT("PATH"));
57 wxString path
= pathlist
.FindValidPath(CMD_IN_PATH
);
58 CPPUNIT_ASSERT( !path
.empty() );