X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be5be16a2326d8bfaa109d522212adffca4dcf5d..6d6f99cb41d940f1fe2963e25e0377b595e3e232:/tests/filename/filenametest.cpp?ds=inline diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index ce964f54b9..70d3dced98 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -28,15 +28,7 @@ #include "wx/msw/registry.h" #endif // __WXMSW__ -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- - -// define stream inserter for wxFileName to use it in CPPUNIT_ASSERT_EQUAL() -inline std::ostream& operator<<(std::ostream& o, const wxFileName& fn) -{ - return o << fn.GetFullPath(); -} +#include "testfile.h" // ---------------------------------------------------------------------------- // test data @@ -132,6 +124,7 @@ private: #ifdef __WINDOWS__ CPPUNIT_TEST( TestShortLongPath ); #endif // __WINDOWS__ + CPPUNIT_TEST( TestUNC ); CPPUNIT_TEST_SUITE_END(); void TestConstruction(); @@ -144,6 +137,7 @@ private: #ifdef __WINDOWS__ void TestShortLongPath(); #endif // __WINDOWS__ + void TestUNC(); DECLARE_NO_COPY_CLASS(FileNameTestCase) }; @@ -315,6 +309,8 @@ void FileNameTestCase::TestNormalize() // test wxPATH_NORM_DOTS { "a/.././b/c/../../", wxPATH_NORM_DOTS, "", wxPATH_UNIX }, + { "./", wxPATH_NORM_DOTS, "", wxPATH_UNIX }, + { "b/../", wxPATH_NORM_DOTS, "", wxPATH_UNIX }, // test wxPATH_NORM_TILDE: notice that ~ is only interpreted specially // when it is the first character in the file name @@ -499,3 +495,15 @@ void FileNameTestCase::TestShortLongPath() } #endif // __WINDOWS__ + +void FileNameTestCase::TestUNC() +{ + wxFileName fn("//share/path/name.ext", wxPATH_DOS); + CPPUNIT_ASSERT_EQUAL( "share", fn.GetVolume() ); + CPPUNIT_ASSERT_EQUAL( "\\path", fn.GetPath(wxPATH_NO_SEPARATOR, wxPATH_DOS) ); + + fn.Assign("\\\\share2\\path2\\name.ext", wxPATH_DOS); + CPPUNIT_ASSERT_EQUAL( "share2", fn.GetVolume() ); + CPPUNIT_ASSERT_EQUAL( "\\path2", fn.GetPath(wxPATH_NO_SEPARATOR, wxPATH_DOS) ); +} +