X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bb5a951418acd22d69a7f1973319f47190fbac79..32753ae949d861ddaf7c66f4c483bc57493c6c6c:/tests/file/dir.cpp?ds=sidebyside diff --git a/tests/file/dir.cpp b/tests/file/dir.cpp index caffd17a6d..81d66ad53e 100644 --- a/tests/file/dir.cpp +++ b/tests/file/dir.cpp @@ -41,11 +41,13 @@ private: CPPUNIT_TEST( DirExists ); CPPUNIT_TEST( Traverse ); CPPUNIT_TEST( Enum ); + CPPUNIT_TEST( GetName ); CPPUNIT_TEST_SUITE_END(); void DirExists(); void Traverse(); void Enum(); + void GetName(); void CreateTempFile(const wxString& path); wxArrayString DirEnumHelper(wxDir& dir, @@ -227,3 +229,19 @@ void DirTestCase::DirExists() CPPUNIT_ASSERT( wxDir::Exists(wxGetCwd()) ); } +void DirTestCase::GetName() +{ + wxDir d; + + CPPUNIT_ASSERT( d.Open(".") ); + CPPUNIT_ASSERT( d.GetName().Last() != wxFILE_SEP_PATH ); + CPPUNIT_ASSERT( d.GetNameWithSep().Last() == wxFILE_SEP_PATH ); + CPPUNIT_ASSERT_EQUAL( d.GetName() + wxFILE_SEP_PATH, + d.GetNameWithSep() ); + +#ifdef __UNIX__ + CPPUNIT_ASSERT( d.Open("/") ); + CPPUNIT_ASSERT_EQUAL( "/", d.GetName() ); + CPPUNIT_ASSERT_EQUAL( "/", d.GetNameWithSep() ); +#endif +}