|
1 | 1 | classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ... |
2 | | - TestTags = {'R2017b', 'impure'}) ... |
| 2 | + TestTags = {'R2017a'}) ... |
3 | 3 | TestSame < matlab.unittest.TestCase |
4 | 4 |
|
| 5 | +properties |
| 6 | +file = 'same.txt' |
| 7 | +cwd |
| 8 | +end |
| 9 | + |
5 | 10 | properties (TestParameter) |
6 | | -p_same = {... |
7 | | -{".", pwd()}, ... |
8 | | -{"..", "./.."}, ... |
9 | | -{"..", pwd() + "/.."}, ... |
10 | | -{pwd(), pwd() + "/."}} |
| 11 | +p = {... |
| 12 | +{'..', './..'}, ... |
| 13 | +{'same.txt', './same.txt'}} |
11 | 14 |
|
12 | 15 | backend = {'python', 'java', 'perl', 'sys', 'native'} |
13 | 16 | end |
14 | 17 |
|
15 | 18 |
|
| 19 | +methods(TestClassSetup) |
| 20 | +function w_dirs(tc) |
| 21 | + f = matlab.unittest.fixtures.WorkingFolderFixture(); |
| 22 | + tc.applyFixture(f); |
| 23 | + tc.cwd = f.Folder; |
| 24 | + tc.assertTrue(stdlib.touch(tc.file)) |
| 25 | +end |
| 26 | +end |
| 27 | + |
| 28 | + |
16 | 29 | methods(Test) |
17 | 30 |
|
18 | | -function test_samepath(tc, p_same, backend) |
19 | | -[r, b] = stdlib.samepath(p_same{:}, backend); |
| 31 | +function test_samepath(tc, p, backend) |
| 32 | +[r, b] = stdlib.samepath(p{:}, backend); |
20 | 33 | tc.assertEqual(char(b), backend) |
21 | 34 | tc.verifyClass(r, 'logical') |
22 | 35 |
|
23 | 36 | if ismember(backend, stdlib.Backend().select('samepath')) |
24 | | - tc.verifyTrue(r) |
| 37 | + tc.verifyTrue(r, [p{1} ' ' p{2}]) |
25 | 38 | else |
26 | 39 | tc.assertEmpty(r) |
27 | 40 | end |
28 | 41 | end |
29 | 42 |
|
30 | 43 |
|
| 44 | +function test_samepath_cwd(tc, backend) |
| 45 | + |
| 46 | +tc.verifyTrue(stdlib.samepath('.', tc.cwd, backend)) |
| 47 | + |
| 48 | +end |
| 49 | + |
| 50 | + |
31 | 51 | function test_samepath_notexist(tc, backend) |
32 | 52 |
|
33 | 53 | t = tempname(); |
|
0 commit comments