77properties (TestParameter )
88Ps = {" ." , " " , " /" , getenv(" SystemDrive" ), " not-exist" }
99Po = {mfilename(" fullpath" ) + " .m" , pwd(), " ." , " " , tempname()}
10- device_fun = {@stdlib.device, @stdlib. sys.device, @stdlib. java.device, @stdlib. python.device }
11- inode_fun = {@stdlib. inode, @stdlib.sys.inode, @stdlib.java.inode, @stdlib.python.inode }
10+ id_fun = {' sys' , ' java' , ' python' }
11+ id_name = {" inode" , " device " }
1212disk_ac_fun = {' sys' , ' dotnet' , ' java' , ' python' }
1313disk_ac_name = {' disk_available' , ' disk_capacity' }
1414hl_fun = {' java' , ' python' }
@@ -31,10 +31,11 @@ function test_disk_ac(tc, Ps, disk_ac_fun, disk_ac_name)
3131tc .assertNotEmpty(which(n ))
3232
3333try
34+ r = h(Ps , disk_ac_fun );
3435 if stdlib .exists(Ps )
35- tc .verifyGreaterThanOrEqual(h( Ps ) , 0 )
36+ tc .verifyGreaterThanOrEqual(r , 0 )
3637 else
37- tc .verifyEqual(h( Ps ) , uint64(0 ))
38+ tc .verifyEqual(r , uint64(0 ))
3839 end
3940catch e
4041 tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' )
@@ -47,8 +48,10 @@ function test_hard_link_count(tc, hl_fun)
4748n = " stdlib." + hl_fun + " ." + fname ;
4849h = str2func(" stdlib." + fname );
4950tc .assertNotEmpty(which(n ))
51+ P = mfilename(" fullpath" ) + " .m" ;
5052try
51- tc .verifyGreaterThanOrEqual(h(mfilename(" fullpath" ) + " .m" ), 1 )
53+ r = h(P , hl_fun );
54+ tc .verifyGreaterThanOrEqual(r , 1 )
5255catch e
5356 tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' )
5457end
@@ -87,19 +90,20 @@ function test_remove_file(tc)
8790end
8891
8992
90- function test_device(tc , device_fun )
91- is_capable(tc , device_fun )
92-
93- tc .verifyGreaterThan(device_fun(pwd()), uint64(0 ))
94- tc .verifyEqual(device_fun(" ." ), device_fun(pwd()))
93+ function test_inode_device(tc , id_fun , id_name )
94+ n = " stdlib." + id_fun + " ." + id_name ;
95+ h = str2func(" stdlib." + id_name );
96+ tc .assertNotEmpty(which(n ))
9597
98+ try
99+ ip = h(pwd(), id_fun );
100+ tc .verifyClass(ip , ' uint64' )
101+ tc .verifyGreaterThan(ip , 0 )
102+ tc .verifyEqual(h(" ." , id_fun ), ip )
103+ catch e
104+ tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' )
96105end
97106
98-
99- function test_inode(tc , inode_fun )
100- is_capable(tc , inode_fun )
101-
102- tc .verifyEqual(inode_fun(" ." ), inode_fun(pwd()))
103107end
104108
105109
0 commit comments