Skip to content

Commit 47f0655

Browse files
authored
Fix tests in Dart dev channel (flutter#64)
Fixes #60
1 parent 9609e08 commit 47f0655

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

test/common_tests.dart

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ void runCommonTests(
435435

436436
test('throwsIfAlreadyExistsAsFile', () {
437437
fs.file(ns('/foo')).createSync();
438-
expectFileSystemException('File exists', () {
438+
// TODO(tvolkert): Change this to just be 'Not a directory'
439+
// once Dart 1.22 is stable.
440+
RegExp pattern = new RegExp('(File exists|Not a directory)');
441+
expectFileSystemException(pattern, () {
439442
fs.directory(ns('/foo')).createSync();
440443
});
441444
});
@@ -449,7 +452,10 @@ void runCommonTests(
449452
test('throwsIfAlreadyExistsAsLinkToFile', () {
450453
fs.file(ns('/foo')).createSync();
451454
fs.link(ns('/bar')).createSync(ns('/foo'));
452-
expectFileSystemException('File exists', () {
455+
// TODO(tvolkert): Change this to just be 'Not a directory'
456+
// once Dart 1.22 is stable.
457+
RegExp pattern = new RegExp('(File exists|Not a directory)');
458+
expectFileSystemException(pattern, () {
453459
fs.directory(ns('/bar')).createSync();
454460
});
455461
});
@@ -2655,7 +2661,10 @@ void runCommonTests(
26552661

26562662
test('throwsIfPathReferencesDirectoryAndRecursiveFalse', () {
26572663
fs.directory(ns('/foo')).createSync();
2658-
expectFileSystemException('Invalid argument', () {
2664+
// TODO(tvolkert): Change this to just be 'Is a directory'
2665+
// once Dart 1.22 is stable.
2666+
RegExp pattern = new RegExp('(Invalid argument|Is a directory)');
2667+
expectFileSystemException(pattern, () {
26592668
fs.link(ns('/foo')).deleteSync();
26602669
});
26612670
});
@@ -2817,7 +2826,10 @@ void runCommonTests(
28172826

28182827
test('throwsIfPathReferencesDirectory', () {
28192828
fs.directory(ns('/foo')).createSync();
2820-
expectFileSystemException('Invalid argument', () {
2829+
// TODO(tvolkert): Change this to just be 'Is a directory'
2830+
// once Dart 1.22 is stable.
2831+
RegExp pattern = new RegExp('(Invalid argument|Is a directory)');
2832+
expectFileSystemException(pattern, () {
28212833
fs.link(ns('/foo')).updateSync(ns('/bar'));
28222834
});
28232835
});
@@ -3063,16 +3075,16 @@ const Matcher isFileSystemEntity = const _IsFileSystemEntity();
30633075

30643076
Matcher hasPath(String path) => new _HasPath(equals(path));
30653077

3066-
Matcher isFileSystemException([String msg]) => new _FileSystemException(msg);
3067-
Matcher throwsFileSystemException([String msg]) =>
3078+
Matcher isFileSystemException([Pattern msg]) => new _FileSystemException(msg);
3079+
Matcher throwsFileSystemException([Pattern msg]) =>
30683080
new Throws(isFileSystemException(msg));
30693081

3070-
void expectFileSystemException(String msg, void callback()) {
3082+
void expectFileSystemException(Pattern msg, void callback()) {
30713083
expect(callback, throwsFileSystemException(msg));
30723084
}
30733085

30743086
class _FileSystemException extends Matcher {
3075-
final String msg;
3087+
final Pattern msg;
30763088
const _FileSystemException(this.msg);
30773089

30783090
Description describe(Description description) =>

0 commit comments

Comments
 (0)