|
1 | 1 | classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ... |
2 | | - TestTags = {'R2021a', 'pure'}) ... |
| 2 | + TestTags = {'R2019b', 'pure'}) ... |
3 | 3 | TestFilename < matlab.unittest.TestCase |
4 | 4 |
|
5 | 5 | properties (TestParameter) |
6 | | -p |
7 | | -backend = {'regexp', 'pattern'} |
| 6 | +p = init_p() |
| 7 | +backend = {'regexp'} |
| 8 | +end |
| 9 | + |
| 10 | + |
| 11 | +methods (Test) |
| 12 | + |
| 13 | +function test_filename(tc, p, backend) |
| 14 | +fn = stdlib.filename(p{1}, backend); |
| 15 | +tc.verifyEqual(fn, p{2}) |
| 16 | +end |
| 17 | + |
| 18 | +end |
| 19 | + |
8 | 20 | end |
9 | 21 |
|
10 | 22 |
|
11 | | -methods (TestParameterDefinition, Static) |
12 | 23 | function p = init_p() |
13 | 24 | p = { |
14 | 25 | {'', ""}, ... |
|
24 | 35 | p{end+1} = {"c:/df\df.txt", "df.txt"}; |
25 | 36 | end |
26 | 37 | end |
27 | | -end |
28 | | - |
29 | | - |
30 | | -methods (Test) |
31 | | - |
32 | | -function test_filename(tc, p, backend) |
33 | | -fn = stdlib.filename(p{1}, backend); |
34 | | -tc.verifyEqual(fn, p{2}) |
35 | | -end |
36 | | - |
37 | | -function test_filename_array(tc, backend) |
38 | | -in = ["", "a", "a/b/c", "a/b/", "a/b/c.txt", "a/b/.hidden", "a/b/c/"]; |
39 | | -exp = ["", "a", "c", "", "c.txt", ".hidden", ""]; |
40 | | -out = stdlib.filename(in, backend); |
41 | | -tc.verifyEqual(out, exp) |
42 | | -end |
43 | | - |
44 | | -end |
45 | | - |
46 | | -end |
0 commit comments