Skip to content

Commit 304fb3c

Browse files
authored
Merge pull request #257 from mdrazak2001/test-fix-219
Fix broken test on Windows
2 parents f1d666f + 890a446 commit 304fb3c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/utils/file_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ String getShortPath(String path) {
4343
var f = p.split(path);
4444
if (f.length > 2) {
4545
f = f.sublist(f.length - 2);
46-
return ".../${p.joinAll(f)}";
46+
return p.join("...", p.joinAll(f));
4747
}
4848
return path;
4949
}

test/utils/file_utils_test.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:apidash/consts.dart';
12
import 'package:test/test.dart';
23
import 'package:apidash/utils/file_utils.dart';
34

@@ -11,8 +12,13 @@ void main() {
1112
});
1213

1314
test('Test getShortPath', () {
14-
String path = "A/B/C/D.csv";
15-
expect(getShortPath(path), ".../C/D.csv");
15+
if (kIsWindows) {
16+
String path = r"A\B\C\D.csv";
17+
expect(getShortPath(path), r"...\C\D.csv");
18+
} else {
19+
String path = "A/B/C/D.csv";
20+
expect(getShortPath(path), ".../C/D.csv");
21+
}
1622
});
1723

1824
test('Test getTempFileName', () {

0 commit comments

Comments
 (0)