Don't remove the last slash from "/" directory name under Unix.

This was totally wrong as it returned empty string as (invalid) directory
name.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-05-04 18:31:48 +00:00
parent 7bb22bd68d
commit bb91ff63bc
3 changed files with 24 additions and 3 deletions

View File

@@ -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,15 @@ 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 );
#ifdef __UNIX__
CPPUNIT_ASSERT( d.Open("/") );
CPPUNIT_ASSERT_EQUAL( "/", d.GetName() );
#endif
}