33methods (Test )
44
55function test_posix(tc )
6+ import matlab .unittest .constraints .ContainsSubstring
67
78tc .verifyEmpty(stdlib .posix(string .empty ))
89tc .verifyEqual(stdlib .posix(" " ), " " )
910
1011if ispc
11- tc .verifyFalse(contains( stdlib .posix(" c:\foo" ), " \" ))
12- tc .verifyFalse(all(contains( stdlib .posix([" x:\123" , " d:\abc" ]), " \" ) ))
12+ tc .verifyThat( stdlib .posix(" c:\foo" ), ~ContainsSubstring( " \" ))
13+ tc .verifyThat( stdlib .posix([" x:\123" , " d:\abc" ]), ~ContainsSubstring( " \" ))
1314end
1415end
1516
@@ -106,6 +107,7 @@ function test_is_absolute_path(tc)
106107end
107108
108109function test_absolute_path(tc )
110+ import matlab .unittest .constraints .StartsWithSubstring
109111
110112import stdlib.absolute_path
111113tc .assumeTrue(usejava(" jvm" ), " Java required" )
@@ -115,7 +117,7 @@ function test_absolute_path(tc)
115117
116118pabs = absolute_path(' 2foo' );
117119pabs2 = absolute_path(' 4foo' );
118- tc .verifyFalse(startsWith( pabs , " 2" ))
120+ tc .verifyThat( pabs , ~StartsWithSubstring( " 2" ))
119121tc .verifyTrue(strncmp(pabs , pabs2 , 2 ))
120122
121123par1 = absolute_path(" ../2foo" );
@@ -129,7 +131,7 @@ function test_absolute_path(tc)
129131
130132va = absolute_path(" 2foo" );
131133vb = absolute_path(" 4foo" );
132- tc .verifyFalse(startsWith( va , " 2" ))
134+ tc .verifyThat( va , ~StartsWithSubstring( " 2" ))
133135tc .verifyTrue(strncmp(va , vb , 2 ))
134136
135137end
@@ -171,6 +173,9 @@ function test_canonical(tc)
171173function test_resolve(tc )
172174import matlab .unittest .fixtures .TemporaryFolderFixture
173175import matlab .unittest .fixtures .CurrentFolderFixture
176+ import matlab .unittest .constraints .StartsWithSubstring
177+ import matlab .unittest .constraints .EndsWithSubstring
178+ import matlab .unittest .constraints .ContainsSubstring
174179import stdlib .resolve
175180tc .assumeTrue(usejava(" jvm" ), " Java required" )
176181
@@ -183,23 +188,23 @@ function test_resolve(tc)
183188
184189pabs = resolve(' 2foo' );
185190pabs2 = resolve(' 4foo' );
186- tc .verifyFalse(startsWith( pabs , " 2" ))
191+ tc .verifyThat( pabs , ~StartsWithSubstring( " 2" ))
187192tc .verifyTrue(strncmp(pabs , pabs2 , 2 ))
188193
189194par1 = resolve(" ../2foo" );
190195tc .verifyNotEmpty(par1 )
191- tc .verifyFalse(contains( par1 , " .." ))
196+ tc .verifyThat( par1 , ~ContainsSubstring( " .." ))
192197
193198par2 = resolve(" ../4foo" );
194199tc .verifyTrue(strncmp(par2 , pabs2 , 2 ))
195200
196201pt1 = resolve(" bar/../2foo" );
197202tc .verifyNotEmpty(pt1 )
198- tc .verifyFalse(contains( pt1 , " .." ))
203+ tc .verifyThat( pt1 , ~ContainsSubstring( " .." ))
199204
200205va = resolve(" 2foo" );
201206vb = resolve(" 4foo" );
202- tc .verifyFalse(startsWith( va , " 2" ))
207+ tc .verifyThat( va , ~StartsWithSubstring( " 2" ))
203208tc .verifyTrue(strncmp(va , vb , 2 ))
204209
205210% test existing file
0 commit comments