Skip to content

Commit 555eb91

Browse files
committed
Fix and add test
1 parent 0d19ee2 commit 555eb91

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/xy.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* | Mikachu2333 <[email protected]>
88
* |
99
* Created On : <2023-08-30>
10-
* Last Modified : <2025-08-11>
10+
* Last Modified : <2025-08-18>
1111
*
1212
* Test xy.h
1313
* ------------------------------------------------------------*/
@@ -98,18 +98,23 @@ main (int argc, char const *argv[])
9898
assert (xy_dir_exist ("~"));
9999
if (xy_on_windows)
100100
{
101+
say (xy_normalize_path ("~"));
102+
say (xy_normalize_path ("~/"));
103+
// xy_parent_dir() 得到的结果一定是不包含尾斜杠的目录名
104+
assert_str (xy_parent_dir (xy_normalize_path ("~")), "C:\\Users");
105+
assert_str (xy_parent_dir (xy_normalize_path ("~/")), "C:\\Users");
106+
assert (xy_dir_exist ("C:\\Users"));
107+
101108
say (xy_win_powershell_profile);
102109
say (xy_win_powershellv5_profile);
103110
assert (xy_file_exist (xy_win_powershell_profile));
104111
assert (true == xy_file_exist (xy_win_powershellv5_profile));
105-
assert (xy_dir_exist ("C:\\Users"));
112+
106113
assert_str (xy_normalize_path ("C:\\a bc\\def\\"), "C:\\a bc\\def\\");
107114
assert_str (xy_normalize_path ("a/b c/d"), "a\\b c\\d");
108115
assert_str (xy_normalize_path ("a/b c/d/"), "a\\b c\\d\\");
109116
assert_str (xy_parent_dir ("a/b c/d"), "a\\b c");
110117
assert_str (xy_parent_dir ("a/b c\\d/"), "a\\b c");
111-
assert_str (xy_parent_dir (xy_normalize_path ("~/")), "C:\\Users");
112-
assert_str (xy_parent_dir (xy_normalize_path ("~")), "C:\\Users");
113118
}
114119
else
115120
{

0 commit comments

Comments
 (0)