-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTestWindowsCOM.m
50 lines (35 loc) · 967 Bytes
/
TestWindowsCOM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
classdef TestWindowsCOM < matlab.unittest.TestCase
properties (TestParameter)
Pn = {""}
Pmr = {string(matlabroot), stdlib.posix(matlabroot)}
end
methods (Test)
function test_not(tc, Pn)
tc.verifyEqual(stdlib.windows_shortname(Pn), "")
end
function test_short_folder(tc)
import matlab.unittest.constraints.IsFolder
progdir = stdlib.posix(getenv("PROGRAMFILES"));
tc.assumeThat(progdir, IsFolder, "$Env:PROGRAMFILES is not a directory")
short = stdlib.windows_shortname(progdir);
if ispc
tc.verifySubstring(short, "PROGRA~1")
tc.verifyEqual(stdlib.canonical(short), progdir)
else
tc.verifyEqual(short, progdir)
end
end
function test_short_file(tc, Pmr)
import matlab.unittest.constraints.IsFile
s = stdlib.windows_shortname(Pmr);
if ispc
if contains(Pmr, " ")
tc.verifySubstring(s, "~")
end
tc.verifyEqual(stdlib.canonical(s), stdlib.posix(Pmr), "shortname didn't resolve same as canonical")
else
tc.verifyEqual(s, Pmr)
end
end
end
end