File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 1+ classdef TestUnit < matlab .unittest .TestCase
2+
3+ methods (Test )
4+
5+ function test_expanduser(tc )
6+ tc .verifyEmpty(expanduser(string .empty ))
7+ tc .verifyFalse(startsWith(expanduser(" ~" ), " ~" ))
8+ tc .verifyFalse(any(startsWith(expanduser([" ~" ," ~" ]), " ~" )))
9+
10+ a = expanduser([" ~" , " foo" ]);
11+ tc .verifyEqual(a(2 ), " foo" )
12+ tc .verifyNotEqual(a(1 ), " ~" )
13+ end
14+
15+ end
16+
17+ end
Original file line number Diff line number Diff line change 11function A = coerce_ds(A , dtype )
22% used by h5save and ncsave
33arguments
4- A { mustBeNonempty }
4+ A
55 dtype string
66end
77
Original file line number Diff line number Diff line change 2424
2525expanded = p ;
2626
27- if ~startsWith(expanded , " ~" )
28- return
29- end
30-
3127if ispc
3228 home = getenv(' USERPROFILE' );
3329else
3430 home = getenv(' HOME' );
3531end
3632
3733if ~isempty(home )
38- expanded = fullfile(home , extractAfter(expanded , 1 ));
34+ i = startsWith(expanded , " ~" );
35+ expanded(i ) = fullfile(home , extractAfter(expanded(i ), 1 ));
3936end
4037
4138end % function
You can’t perform that action at this time.
0 commit comments