Skip to content

Commit eaabddc

Browse files
committed
test:device fun param
1 parent 21d4344 commit eaabddc

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

+stdlib/+java/device.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function i = device(p)
2+
3+
opt = javaMethod("values", "java.nio.file.LinkOption");
4+
i = java.nio.file.Files.getAttribute(javaPathObject(p), "unix:dev", opt);
5+
6+
end

test/TestDisk.m

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
properties (TestParameter)
99
Ps = {".", "", "/", getenv("SystemDrive"), "not-exist"}
10+
device_fun = init_device_fun()
1011
end
1112

1213
methods (Test)
@@ -60,12 +61,11 @@ function test_filesystem_type(tc, Ps)
6061
end
6162

6263

63-
function test_device(tc)
64-
64+
function test_device(tc, device_fun)
6565
if ispc()
66-
tc.verifyGreaterThan(stdlib.device(pwd()), 0)
66+
tc.verifyGreaterThan(device_fun(pwd()), 0)
6767
else
68-
tc.verifyEqual(stdlib.device("."), stdlib.device(pwd()))
68+
tc.verifyEqual(device_fun("."), device_fun(pwd()))
6969
end
7070
end
7171

@@ -86,3 +86,16 @@ function test_owner(tc)
8686

8787
end
8888
end
89+
90+
91+
function device_fun = init_device_fun()
92+
device_fun = {@stdlib.sys.device, @stdlib.device};
93+
94+
if isunix() && stdlib.java_api() > 11
95+
device_fun{end+1} = @stdlib.java.device;
96+
end
97+
98+
if stdlib.has_python()
99+
device_fun{end+1} = @stdlib.python.device;
100+
end
101+
end

test/TestSys.m

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,4 @@ function test_ram_free(tc)
125125
end
126126

127127

128-
methods (Test, TestTags="sys")
129-
130-
function test_ram_free_sys(tc)
131-
f = stdlib.sys.ram_free();
132-
tc.verifyGreaterThan(f, 0)
133-
tc.verifyClass(f, 'uint64')
134-
end
135-
136-
end
137-
138128
end

0 commit comments

Comments
 (0)