2010-06-06 10:21:27 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tests/misc/pathlist.cpp
|
|
|
|
// Purpose: Test wxPathList
|
|
|
|
// Author: Francesco Montorsi (extracted from console sample)
|
|
|
|
// Created: 2010-06-02
|
|
|
|
// Copyright: (c) 2010 wxWidgets team
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "testprec.h"
|
|
|
|
|
|
|
|
#include "wx/filefn.h"
|
|
|
|
|
2017-11-25 06:08:40 -05:00
|
|
|
TEST_CASE("wxPathList::FindValidPath", "[file][path]")
|
2010-06-06 10:21:27 -04:00
|
|
|
{
|
|
|
|
#ifdef __UNIX__
|
2017-11-25 06:08:40 -05:00
|
|
|
#define CMD_IN_PATH "ls"
|
2010-06-06 10:21:27 -04:00
|
|
|
#else
|
2017-11-25 06:08:40 -05:00
|
|
|
#define CMD_IN_PATH "cmd.exe"
|
2010-06-06 10:21:27 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
wxPathList pathlist;
|
|
|
|
pathlist.AddEnvList(wxT("PATH"));
|
2018-07-29 05:09:17 -04:00
|
|
|
|
2010-06-06 10:21:27 -04:00
|
|
|
wxString path = pathlist.FindValidPath(CMD_IN_PATH);
|
2017-11-25 06:08:40 -05:00
|
|
|
INFO( CMD_IN_PATH " not found in " << wxGetenv("PATH") );
|
|
|
|
CHECK( !path.empty() );
|
2010-06-06 10:21:27 -04:00
|
|
|
}
|