Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: test/runner/loader_test.dart

Issue 1083433002: More gracefully handle load errors. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/runner/browser/runner_test.dart ('k') | test/runner/pub_serve_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/loader_test.dart
diff --git a/test/runner/loader_test.dart b/test/runner/loader_test.dart
index f56bc94b4a9a1871c743f4c6814ed7780baac477..f5e8160848097826367189249ce2d49dfb228345 100644
--- a/test/runner/loader_test.dart
+++ b/test/runner/loader_test.dart
@@ -49,7 +49,8 @@ void main() {
/// TODO(nweiz): Use scheduled_test for this once it's compatible with
/// this version of test.
new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync(_tests);
- return _loader.loadFile(p.join(_sandbox, 'a_test.dart')).then((suites) {
+ return _loader.loadFile(p.join(_sandbox, 'a_test.dart')).toList()
+ .then((suites) {
expect(suites, hasLength(1));
suite = suites.first;
});
@@ -88,7 +89,7 @@ void main() {
test("throws a nice error if the package root doesn't exist", () {
var loader = new Loader([TestPlatform.vm]);
expect(
- loader.loadFile(p.join(_sandbox, 'a_test.dart'))
+ loader.loadFile(p.join(_sandbox, 'a_test.dart')).first
.whenComplete(loader.close),
throwsA(isLoadException(
"Directory ${p.join(_sandbox, 'packages')} does not exist.")));
@@ -98,19 +99,19 @@ void main() {
group(".loadDir()", () {
test("ignores non-Dart files", () {
new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests);
- expect(_loader.loadDir(_sandbox), completion(isEmpty));
+ expect(_loader.loadDir(_sandbox).toList(), completion(isEmpty));
});
test("ignores files in packages/ directories", () {
var dir = p.join(_sandbox, 'packages');
new Directory(dir).createSync();
new File(p.join(dir, 'a_test.dart')).writeAsStringSync(_tests);
- expect(_loader.loadDir(_sandbox), completion(isEmpty));
+ expect(_loader.loadDir(_sandbox).toList(), completion(isEmpty));
});
test("ignores files that don't end in _test.dart", () {
new File(p.join(_sandbox, 'test.dart')).writeAsStringSync(_tests);
- expect(_loader.loadDir(_sandbox), completion(isEmpty));
+ expect(_loader.loadDir(_sandbox).toList(), completion(isEmpty));
});
group("with suites loaded from a directory", () {
@@ -125,7 +126,8 @@ void main() {
new File(p.join(_sandbox, 'dir/sub_test.dart'))
.writeAsStringSync(_tests);
- return _loader.loadDir(_sandbox).then((suites_) => suites = suites_);
+ return _loader.loadDir(_sandbox).toList()
+ .then((suites_) => suites = suites_);
});
test("gives those suites the correct paths", () {
« no previous file with comments | « test/runner/browser/runner_test.dart ('k') | test/runner/pub_serve_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698