Skip to content

Commit 5926799

Browse files
committed
remove duplicate checks
1 parent 97942c0 commit 5926799

File tree

8 files changed

+24
-15
lines changed

8 files changed

+24
-15
lines changed

+stdlib/makedir.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ function makedir(direc)
1010
%% to avoid confusing making ./~/mydir
1111
direc = stdlib.expanduser(direc);
1212

13-
if ~stdlib.strempty(direc) && ~isfolder(direc)
14-
[~] = mkdir(direc);
13+
if ~stdlib.strempty(direc)
14+
[s, ~] = mkdir(direc);
1515
end
1616

17-
ok = isfolder(direc);
17+
ok = s == 1;
18+
19+
if ~stdlib.matlabOlderThan('R2017b')
20+
ok = ok && isfolder(direc);
21+
end
1822

1923
if nargout == 0
2024
assert(ok, 'Failed to create directory: %s', direc)

+stdlib/which.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
else
6262
e = stdlib.append(p, '/', cmd);
6363
end
64-
if isfile(e) && stdlib.is_exe(e)
64+
if stdlib.is_exe(e)
6565
if find_all
6666
exe(end+1) = e; %#ok<AGROW>
6767
else

test/TestExpanduser.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2017b', 'impure'}) ...
2+
TestTags = {'R2017a', 'impure'}) ...
33
TestExpanduser < matlab.unittest.TestCase
44

55
properties (TestParameter)

test/TestFileImpure.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2017b', 'impure'}) ...
2+
TestTags = {'R2017a', 'impure'}) ...
33
TestFileImpure < matlab.unittest.TestCase
44

55
properties (TestParameter)

test/TestSuffix.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2017b', 'pure'}) ...
2+
TestTags = {'R2017a', 'pure'}) ...
33
TestSuffix < matlab.unittest.TestCase
44

55
properties (TestParameter)
6-
p = {{"", ""}, {"/a/b/c", ""}, ...
7-
{"/a/b/c/", ""}, {"a/b/c.txt", ".txt"}, ...
8-
{"a/a.b/hi.txt", ".txt"}, ...
9-
{"a/a.b/matlab", ""}, ...
10-
{"a/b/c.txt.gz", ".gz"}, ...
6+
p = {{'', ''}, {'/a/b/c', ''}, ...
7+
{'/a/b/c/', ''}, {'a/b/c.txt', '.txt'}, ...
8+
{'a/a.b/hi.txt', '.txt'}, ...
9+
{'a/a.b/matlab', ''}, ...
10+
{'a/b/c.txt.gz', '.gz'}, ...
1111
{'.stat', ''}, ...
1212
{'a/.stat', ''}, ...
1313
{'.stat.txt', '.txt'}}
@@ -23,6 +23,11 @@ function test_suffix(tc, p)
2323
else
2424
tc.verifyEqual(r, p{2})
2525
end
26+
27+
if ~stdlib.matlabOlderThan('R2017b')
28+
tc.verifyEqual(stdlib.suffix(string(p{1})), string(p{2}))
29+
end
30+
2631
end
2732

2833
end

test/TestSys.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2017b'}) ...
2+
TestTags = {'R2017a'}) ...
33
TestSys < matlab.unittest.TestCase
44

55

test/TestTime.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2017b'}) ...
2+
TestTags = {'R2017a'}) ...
33
TestTime < matlab.unittest.TestCase
44

55
properties (TestParameter)

test/TestVersion.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2017b', 'pure'}) ...
2+
TestTags = {'R2017a', 'pure'}) ...
33
TestVersion < matlab.unittest.TestCase
44

55
properties (TestParameter)

0 commit comments

Comments
 (0)