interpret ~ specially only when it is the first character of the path (closes #10948, see #10941)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-07-01 09:07:38 +00:00
parent 9630954d5d
commit be5be16a23
2 changed files with 22 additions and 25 deletions

View File

@@ -65,6 +65,8 @@ static struct TestFileNameInfo
{ "../../foo", "", "../..", "foo", "", false, wxPATH_UNIX },
{ "foo.bar", "", "", "foo", "bar", false, wxPATH_UNIX },
{ "~/foo.bar", "", "~", "foo", "bar", true, wxPATH_UNIX },
{ "~user/foo.bar", "", "~user", "foo", "bar", true, wxPATH_UNIX },
{ "~user/", "", "~user", "", "", true, wxPATH_UNIX },
{ "/foo", "", "/", "foo", "", true, wxPATH_UNIX },
{ "Mahogany-0.60/foo.bar", "", "Mahogany-0.60", "foo", "bar", false, wxPATH_UNIX },
{ "/tmp/wxwin.tar.bz", "", "/tmp", "wxwin.tar", "bz", true, wxPATH_UNIX },
@@ -314,10 +316,10 @@ void FileNameTestCase::TestNormalize()
// test wxPATH_NORM_DOTS
{ "a/.././b/c/../../", wxPATH_NORM_DOTS, "", wxPATH_UNIX },
// test wxPATH_NORM_TILDE
// NB: do the tilde expansion also under Windows to test if it works there too
// test wxPATH_NORM_TILDE: notice that ~ is only interpreted specially
// when it is the first character in the file name
{ "/a/b/~", wxPATH_NORM_TILDE, "/a/b/~", wxPATH_UNIX },
{ "/~/a/b", wxPATH_NORM_TILDE, "HOME/a/b", wxPATH_UNIX },
{ "/~/a/b", wxPATH_NORM_TILDE, "/~/a/b", wxPATH_UNIX },
{ "~/a/b", wxPATH_NORM_TILDE, "HOME/a/b", wxPATH_UNIX },
// test wxPATH_NORM_CASE