Skip to content

Commit 5a03508

Browse files
committed
test: improve tempdir efficiency
1 parent 86b32b0 commit 5a03508

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ These system, filesystem, and HDF5 / HDF4 / NetCDF functions are used across num
1212

1313
Matlab R2019b is the minimum required due to use of
1414
[function argument validation](https://www.mathworks.com/help/matlab/ref/arguments.html).
15+
Full functionality on macOS and Windows require minimum of Matlab R2020b (most functions work in R2019b and newer).
16+
Full functionality on Linux with minimum Matlab R2019b.
17+
1518

1619
## Self-tests
1720

test/TestAbsolute.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
methods(TestClassSetup)
1414
function test_dirs(tc)
15-
tc.td = createTempdir(tc);
1615
pkg_path(tc)
16+
tc.td = createTempdir(tc);
1717

1818
tc.applyFixture(matlab.unittest.fixtures.CurrentFolderFixture(tc.td))
1919
end

test/private/createTempdir.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
tc (1,1) matlab.unittest.TestCase
44
end
55

6-
if stdlib.matlabOlderThan('R2022a')
6+
try
7+
td = tc.createTemporaryFolder();
8+
catch e
9+
if e.identifier ~= "MATLAB:noSuchMethodOrField"
10+
rethrow(e)
11+
end
12+
713
td = tempname();
814
[ok, err] = mkdir(td);
915
tc.assumeTrue(ok, err)
1016
tc.addTeardown(@() rmdir(td, 's'))
11-
else
12-
td = tc.createTemporaryFolder();
1317
end
1418

1519
assert(nargout == 1, "use this function to set a test Property or variable directly")

0 commit comments

Comments
 (0)