Use the new test runner. Closes dart-lang/watcher#11 R=rnystrom@google.com Review URL: https://codereview.chromium.org//1183723003.
diff --git a/pkgs/watcher/pubspec.yaml b/pkgs/watcher/pubspec.yaml index a0d3000..08695c9 100644 --- a/pkgs/watcher/pubspec.yaml +++ b/pkgs/watcher/pubspec.yaml
@@ -6,10 +6,10 @@ A file system watcher. It monitors changes to contents of directories and sends notifications when files have been added, removed, or modified. environment: - sdk: '>=1.0.0 <2.0.0' + sdk: '>=1.8.0 <2.0.0' dependencies: path: '>=0.9.0 <2.0.0' stack_trace: '>=0.9.1 <2.0.0' dev_dependencies: - scheduled_test: '>=0.9.3 <0.12.0' - unittest: '>=0.9.2 <0.12.0' + scheduled_test: '^0.12.0' + test: '^0.12.0'
diff --git a/pkgs/watcher/test/directory_watcher/linux_test.dart b/pkgs/watcher/test/directory_watcher/linux_test.dart index c17eb53..15eb0ce 100644 --- a/pkgs/watcher/test/directory_watcher/linux_test.dart +++ b/pkgs/watcher/test/directory_watcher/linux_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('linux') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/linux.dart'; import 'package:watcher/watcher.dart'; @@ -10,8 +12,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new LinuxDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/directory_watcher/mac_os_test.dart b/pkgs/watcher/test/directory_watcher/mac_os_test.dart index 0320e3c..e9a1696 100644 --- a/pkgs/watcher/test/directory_watcher/mac_os_test.dart +++ b/pkgs/watcher/test/directory_watcher/mac_os_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('mac-os') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/mac_os.dart'; import 'package:watcher/watcher.dart'; @@ -10,7 +12,6 @@ import '../utils.dart'; void main() { - initConfig(); watcherFactory = (dir) => new MacOSDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/directory_watcher/polling_test.dart b/pkgs/watcher/test/directory_watcher/polling_test.dart index 1ef49b5..0192b25 100644 --- a/pkgs/watcher/test/directory_watcher/polling_test.dart +++ b/pkgs/watcher/test/directory_watcher/polling_test.dart
@@ -9,8 +9,6 @@ import '../utils.dart'; void main() { - initConfig(); - // Use a short delay to make the tests run quickly. watcherFactory = (dir) => new PollingDirectoryWatcher(dir, pollingDelay: new Duration(milliseconds: 100));
diff --git a/pkgs/watcher/test/directory_watcher/windows_test.dart b/pkgs/watcher/test/directory_watcher/windows_test.dart index ea5c8c5..4c77ced 100644 --- a/pkgs/watcher/test/directory_watcher/windows_test.dart +++ b/pkgs/watcher/test/directory_watcher/windows_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('windows') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/windows.dart'; import 'package:watcher/watcher.dart'; @@ -10,8 +12,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new WindowsDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/no_subscription/linux_test.dart b/pkgs/watcher/test/no_subscription/linux_test.dart index f7f1b49..c8e8ae9 100644 --- a/pkgs/watcher/test/no_subscription/linux_test.dart +++ b/pkgs/watcher/test/no_subscription/linux_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('linux') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/linux.dart'; @@ -9,8 +11,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new LinuxDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/no_subscription/mac_os_test.dart b/pkgs/watcher/test/no_subscription/mac_os_test.dart index 721d3e7..d5b1c8e 100644 --- a/pkgs/watcher/test/no_subscription/mac_os_test.dart +++ b/pkgs/watcher/test/no_subscription/mac_os_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('mac-os') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/mac_os.dart'; @@ -9,8 +11,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new MacOSDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/no_subscription/polling_test.dart b/pkgs/watcher/test/no_subscription/polling_test.dart index c71b5ce..5c99bc0 100644 --- a/pkgs/watcher/test/no_subscription/polling_test.dart +++ b/pkgs/watcher/test/no_subscription/polling_test.dart
@@ -9,8 +9,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new PollingDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/no_subscription/shared.dart b/pkgs/watcher/test/no_subscription/shared.dart index 9ba5c98..52649f1 100644 --- a/pkgs/watcher/test/no_subscription/shared.dart +++ b/pkgs/watcher/test/no_subscription/shared.dart
@@ -18,7 +18,7 @@ // Subscribe to the events. var completer = new Completer(); - var subscription = watcher.events.listen(wrapAsync((event) { + var subscription = watcher.events.listen(expectAsync((event) { expect(event, isWatchEvent(ChangeType.ADD, "file.txt")); completer.complete(); })); @@ -39,7 +39,7 @@ // Then start listening again. schedule(() { completer = new Completer(); - subscription = watcher.events.listen(wrapAsync((event) { + subscription = watcher.events.listen(expectAsync((event) { // We should get an event for the third file, not the one added while // we weren't subscribed. expect(event, isWatchEvent(ChangeType.ADD, "added.txt"));
diff --git a/pkgs/watcher/test/path_set_test.dart b/pkgs/watcher/test/path_set_test.dart index f433ad3..13e797c 100644 --- a/pkgs/watcher/test/path_set_test.dart +++ b/pkgs/watcher/test/path_set_test.dart
@@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:path/path.dart' as p; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; import 'package:watcher/src/path_set.dart'; import 'utils.dart'; @@ -17,8 +17,6 @@ 'set contains directory "$path"'); void main() { - initConfig(); - var set; setUp(() => set = new PathSet("root"));
diff --git a/pkgs/watcher/test/ready/linux_test.dart b/pkgs/watcher/test/ready/linux_test.dart index f7f1b49..c8e8ae9 100644 --- a/pkgs/watcher/test/ready/linux_test.dart +++ b/pkgs/watcher/test/ready/linux_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('linux') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/linux.dart'; @@ -9,8 +11,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new LinuxDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/ready/mac_os_test.dart b/pkgs/watcher/test/ready/mac_os_test.dart index 721d3e7..d5b1c8e 100644 --- a/pkgs/watcher/test/ready/mac_os_test.dart +++ b/pkgs/watcher/test/ready/mac_os_test.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('mac-os') + import 'package:scheduled_test/scheduled_test.dart'; import 'package:watcher/src/directory_watcher/mac_os.dart'; @@ -9,8 +11,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new MacOSDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/ready/polling_test.dart b/pkgs/watcher/test/ready/polling_test.dart index c71b5ce..5c99bc0 100644 --- a/pkgs/watcher/test/ready/polling_test.dart +++ b/pkgs/watcher/test/ready/polling_test.dart
@@ -9,8 +9,6 @@ import '../utils.dart'; void main() { - initConfig(); - watcherFactory = (dir) => new PollingDirectoryWatcher(dir); setUp(createSandbox);
diff --git a/pkgs/watcher/test/utils.dart b/pkgs/watcher/test/utils.dart index 2953c98..85fe6d3 100644 --- a/pkgs/watcher/test/utils.dart +++ b/pkgs/watcher/test/utils.dart
@@ -9,7 +9,6 @@ import 'package:path/path.dart' as p; import 'package:scheduled_test/scheduled_stream.dart'; import 'package:scheduled_test/scheduled_test.dart'; -import 'package:unittest/compact_vm_config.dart'; import 'package:watcher/watcher.dart'; import 'package:watcher/src/stat.dart'; import 'package:watcher/src/utils.dart'; @@ -43,11 +42,6 @@ } WatcherFactory _watcherFactory; -void initConfig() { - useCompactVMConfiguration(); - filterStacks = true; -} - /// Creates the sandbox directory the other functions in this library use and /// ensures it's deleted when the test ends. ///