Skip to content

Commit 5717d80

Browse files
committed
test:windows_shortpath: more robust compare
1 parent fca4003 commit 5717d80

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/TestWindowsCOM.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
classdef TestWindowsCOM < matlab.unittest.TestCase
22

33
properties (TestParameter)
4-
Pn = {""}
4+
Pn = {{"", ""}}
55
Pmr = {matlabroot, stdlib.posix(matlabroot)}
66
end
77

88
methods (Test)
99

1010
function test_not(tc, Pn)
11-
tc.verifyEqual(stdlib.windows_shortname(Pn), "")
11+
tc.verifyEqual(stdlib.windows_shortname(Pn{1}), Pn{2})
1212
end
1313

1414
function test_short_folder(tc)
1515
import matlab.unittest.constraints.IsFolder
1616

17-
progdir = stdlib.posix(getenv("PROGRAMFILES"));
17+
progdir = getenv("PROGRAMFILES");
1818
if ispc()
1919
tc.assertThat(progdir, IsFolder, "$Env:PROGRAMFILES is not a directory")
2020
end
@@ -32,19 +32,20 @@ function test_short_folder(tc)
3232

3333

3434
function test_short_file(tc, Pmr)
35-
import matlab.unittest.constraints.IsFile
3635

3736
s = stdlib.windows_shortname(Pmr);
3837

3938
if ispc
4039
if contains(Pmr, " ")
4140
tc.verifySubstring(s, "~")
4241
end
43-
tc.verifyEqual(stdlib.canonical(s), stdlib.posix(Pmr), "shortname didn't resolve same as canonical")
44-
else
45-
tc.verifyEqual(s, string(Pmr))
42+
43+
tc.verifyLessThanOrEqual(strlength(s), strlength(Pmr))
4644
end
4745

46+
tc.verifyTrue(stdlib.samepath(s, Pmr),...
47+
sprintf("mex: %d", stdlib.is_mex_fun("stdlib.windows_shortname")))
48+
4849
end
4950

5051
end

0 commit comments

Comments
 (0)