]> git.saurik.com Git - wxWidgets.git/blame - tests/misc/pathlist.cpp
Use __WINDOWS__ for OS checks and __WXMSW__ for GUI checks (round 2).
[wxWidgets.git] / tests / misc / pathlist.cpp
CommitLineData
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
26class PathListTestCase : public CppUnit::TestCase
27{
28public:
29 PathListTestCase() { }
30
31private:
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
42CPPUNIT_TEST_SUITE_REGISTRATION( PathListTestCase );
43
e3778b4d 44// also include in its own registry so that these tests can be run alone
49e323a5
FM
45CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( PathListTestCase, "PathListTestCase" );
46
47void 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