]>
Commit | Line | Data |
---|---|---|
49e323a5 FM |
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 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2010 wxWidgets team | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // ---------------------------------------------------------------------------- | |
11 | // headers | |
12 | // ---------------------------------------------------------------------------- | |
13 | ||
14 | #include "testprec.h" | |
15 | ||
16 | #ifdef __BORLANDC__ | |
17 | # pragma hdrstop | |
18 | #endif | |
19 | ||
20 | #include "wx/filefn.h" | |
21 | ||
22 | // ---------------------------------------------------------------------------- | |
23 | // test class | |
24 | // ---------------------------------------------------------------------------- | |
25 | ||
26 | class PathListTestCase : public CppUnit::TestCase | |
27 | { | |
28 | public: | |
29 | PathListTestCase() { } | |
30 | ||
31 | private: | |
32 | CPPUNIT_TEST_SUITE( PathListTestCase ); | |
33 | CPPUNIT_TEST( FindValidPath ); | |
34 | CPPUNIT_TEST_SUITE_END(); | |
35 | ||
36 | void FindValidPath(); | |
37 | ||
38 | DECLARE_NO_COPY_CLASS(PathListTestCase) | |
39 | }; | |
40 | ||
41 | // register in the unnamed registry so that these tests are run by default | |
42 | CPPUNIT_TEST_SUITE_REGISTRATION( PathListTestCase ); | |
43 | ||
e3778b4d | 44 | // also include in its own registry so that these tests can be run alone |
49e323a5 FM |
45 | CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( PathListTestCase, "PathListTestCase" ); |
46 | ||
47 | void PathListTestCase::FindValidPath() | |
48 | { | |
49 | #ifdef __UNIX__ | |
50 | #define CMD_IN_PATH wxT("ls") | |
51 | #else | |
52 | #define CMD_IN_PATH wxT("cmd.exe") | |
53 | #endif | |
54 | ||
55 | wxPathList pathlist; | |
56 | pathlist.AddEnvList(wxT("PATH")); | |
57 | ||
58 | wxString path = pathlist.FindValidPath(CMD_IN_PATH); | |
59 | CPPUNIT_ASSERT( !path.empty() ); | |
60 | } | |
61 | ||
62 |