Skip to content

Commit e0f7053

Browse files
committed
simplify
1 parent 49b2c87 commit e0f7053

File tree

9 files changed

+21
-34
lines changed

9 files changed

+21
-34
lines changed

+stdlib/canonical.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,5 @@
5353

5454
end
5555

56-
%!assert(canonical("", 1, 0), "")
57-
%!assert(canonical("~", 1, 0), homedir())
58-
%!assert(canonical("a/b/..", 1, 0), "a")
56+
%!assert(canonical("", 1), "")
57+
%!assert(canonical("~", 1), homedir())

+stdlib/file_size.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
end
2020

2121

22-
%!assert (file_size(''), 0)
22+
%!assert (isempty(file_size('')))
2323
%!assert (file_size('file_size.m') > 0)

+stdlib/get_modtime.m

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@
55
p (1,1) string
66
end
77

8-
if stdlib.exists(p)
8+
t = [];
9+
if ~stdlib.exists(p), return, end
910

10-
t = javaFileObject(p).lastModified() / 1000;
11+
t = javaFileObject(p).lastModified() / 1000;
1112

12-
try %#ok<TRYNC>
13-
t = datetime(t, "ConvertFrom", "PosixTime");
14-
end
15-
else
16-
try
17-
t = datetime.empty();
18-
catch
19-
t = [];
20-
end
13+
try %#ok<TRYNC>
14+
t = datetime(t, "ConvertFrom", "PosixTime");
2115
end
2216

2317
end

+stdlib/ncsave_new.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function ncsave_new(file, varname, A, sizeA, ncdims, compressLevel)
77
varname (1,1) string
88
A {mustBeNonempty}
99
sizeA (1,:) double {mustBeInteger,mustBeNonnegative} = []
10-
ncdims cell = {}
10+
ncdims (1,:) cell = {}
1111
compressLevel (1,1) double {mustBeInteger,mustBeNonnegative} = 0
1212
end
1313

+stdlib/normalize.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,4 @@
6565
end
6666

6767

68-
%!assert(normalize("."), ".")
69-
%!assert(normalize("./"), ".")
70-
%!assert(normalize("a/.."), ".")
71-
%!assert(normalize("a/../b"), "b")
72-
%!assert(normalize("a/./b"), "a/b")
73-
%!assert(normalize("a/./b/.."), "a")
74-
%!assert(normalize(""), ".")
68+
%!testif 0

+stdlib/private/file_attributes.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
p (1,1) string
44
end
55

6-
a = struct.empty;
6+
a = [];
77

88
if stdlib.len(p) == 0
99
return
1010
end
1111

1212
[status, a] = fileattrib(p);
1313
if status ~= 1
14-
a = struct.empty;
14+
a = [];
1515
return
1616
end
1717

+stdlib/private/javaPathObject.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
% o = javaFileObject(p).toPath(); % above way about 20% faster
77
catch e
88
if strcmp(e.identifier, "Octave:undefined-function")
9-
o = javafileObject(p).toPath();
9+
o = javaFileObject(p).toPath();
1010
else
1111
rethrow(e);
1212
end

+stdlib/root.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626

2727
end
2828

29-
%!assert(root('',0), '')
30-
%!assert(root('/',0), '/')
29+
%!assert(root(''), '')
30+
%!assert(root('/'), '/')
3131
%!test
3232
%! if ispc
33-
%! assert(root('C:\',0), 'C:/')
34-
%! assert(root('C:/',0), 'C:/')
35-
%! assert(root('C:',0), 'C:')
36-
%! assert(root('C',0), '')
33+
%! assert(root('C:\'), 'C:/')
34+
%! assert(root('C:/'), 'C:/')
35+
%! assert(root('C:'), 'C:')
36+
%! assert(root('C'), '')
3737
%! endif

+stdlib/too_old.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%% TOO_OLD check if Matlab older than R2020b or as specificed by release "r"
1+
%% TOO_OLD check if Matlab older than R2020b or as specified by release "r"
22
% returns true for any version for any Matlab older than R2020b
33
% purpose is to avoid verLessThan lint warnings.
44
%
@@ -21,4 +21,4 @@
2121

2222
end
2323

24-
%!assert (too_old())
24+
%!testif 0

0 commit comments

Comments
 (0)