]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/file/dir.cpp
Add wx/meta/removeref.h header defining wxRemoveRef<> helper.
[wxWidgets.git] / tests / file / dir.cpp
index caffd17a6d8448bdf6a9709e753f0c909c3781f0..81d66ad53e862c4fb7305653777fc8a906cea588 100644 (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,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
+}