Skip to content

Commit 210f8b1

Browse files
committed
test: use tempname() syntax
1 parent 1e00681 commit 210f8b1

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

test/TestExists.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
properties(TestParameter)
44
Ps = {{pwd(), true}, {mfilename("fullpath") + ".m", true}, ...
5-
{"TestFileImpure.m", true} {tempname, false}, ...
5+
{"TestFileImpure.m", true} {tempname(), false}, ...
66
{"", false}}
77
% on CI matlabroot can be writable!
88
end

test/TestFileImpure.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
p_same = {...
1010
{"","", false}, ...
11-
{tempname, tempname, false}, ...
11+
{tempname(), tempname(), false}, ...
1212
{"..", "./..", true}, ...
1313
{"..", pwd() + "/..", true}}
1414

15-
ph = {{0, '"stdin"'}, {1, '"stdout"'}, {2, '"stderr"'}, {fopen(tempname), ""}}
15+
ph = {{0, '"stdin"'}, {1, '"stdout"'}, {2, '"stderr"'}, {fopen(tempname()), ""}}
1616

1717
p_file_size = {mfilename("fullpath") + ".m", "", pwd()}
1818
end
@@ -50,9 +50,10 @@ function test_null_file(tc)
5050

5151
function test_makedir(tc)
5252
import matlab.unittest.constraints.IsFolder
53-
d = tempname;
53+
d = tempname();
5454
stdlib.makedir(d)
5555
tc.assertThat(d, IsFolder)
56+
rmdir(d)
5657
end
5758

5859
%%

test/TestIsExe.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ function test_is_exe(tc, p)
2222
end
2323

2424

25-
p = {{"", false}, {tempname, false}, {".", true}, {f, true}};
25+
p = {{"", false}, {tempname(), false}, {".", true}, {f, true}};
2626
end

test/TestJava.m

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

33
properties (TestParameter)
4-
Ps = {".", tempname, "", "not-exist"}
4+
Ps = {".", "", "not-exist"}
55
end
66

77
methods(TestClassSetup)
@@ -88,7 +88,7 @@ function test_hard_link_count(tc)
8888
tc.verifyGreaterThanOrEqual(stdlib.hard_link_count(fn), 1)
8989
end
9090

91-
tc.verifyEmpty(stdlib.hard_link_count(tempname))
91+
tc.verifyEmpty(stdlib.hard_link_count(tempname()))
9292
end
9393

9494

test/TestPermissions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
classdef TestPermissions < matlab.unittest.TestCase
22

33
properties (TestParameter)
4-
Ps = {".", tempname, "", "not-exist"}
4+
Ps = {".", tempname(), "", "not-exist"}
55
end
66

77
methods (Test)

test/TestSymlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function test_read_symlink(tc)
4848

4949

5050
function test_create_symlink(tc)
51-
tc.verifyFalse(stdlib.create_symlink("", tempname))
51+
tc.verifyFalse(stdlib.create_symlink("", tempname()))
5252
tc.verifyFalse(stdlib.create_symlink(tc.target, tc.link), "should fail for existing symlink")
5353

5454
ano = tc.tempDir + "/another.lnk";

test/TestWhich.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
function test_which_name(tc)
66

7-
tc.verifyEmpty(stdlib.which(tempname))
7+
tc.verifyEmpty(stdlib.which(tempname()))
88

99
if ispc
1010
n = "pwsh.exe";

0 commit comments

Comments
 (0)