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

Unified Diff: test/runner/pub_serve_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/loader_test.dart ('k') | test/runner/runner_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/pub_serve_test.dart
diff --git a/test/runner/pub_serve_test.dart b/test/runner/pub_serve_test.dart
index a3772f60485a29e553da0d3ab43986b57a9901f3..6304b8cfe68add1d6863dfaf0aedef9ba6fd5ec2 100644
--- a/test/runner/pub_serve_test.dart
+++ b/test/runner/pub_serve_test.dart
@@ -136,12 +136,13 @@ class MyTransformer extends Transformer {
try {
var result = runUnittest(['--pub-serve=${match[1]}'],
workingDirectory: _sandbox);
- expect(result.stderr, contains(
- 'Failed to load "test/my_test.dart":'));
- expect(result.stderr, contains('404 Not Found'));
- expect(result.stderr, contains(
- 'Make sure "pub serve" is serving the test/ directory.'));
- expect(result.exitCode, equals(exit_codes.data));
+ expect(result.stdout, allOf([
+ contains('-1: load error'),
+ contains('Failed to load "test/my_test.dart":'),
+ contains('404 Not Found'),
+ contains('Make sure "pub serve" is serving the test/ directory.')
+ ]));
+ expect(result.exitCode, equals(1));
} finally {
process.kill();
}
@@ -165,12 +166,13 @@ class MyTransformer extends Transformer {
var result = runUnittest(
['--pub-serve=${match[1]}', '-p', 'chrome'],
workingDirectory: _sandbox);
- expect(result.stderr, contains(
- 'Failed to load "test/my_test.dart":'));
- expect(result.stderr, contains('404 Not Found'));
- expect(result.stderr, contains(
- 'Make sure "pub serve" is serving the test/ directory.'));
- expect(result.exitCode, equals(exit_codes.data));
+ expect(result.stdout, allOf([
+ contains('-1: load error'),
+ contains('Failed to load "test/my_test.dart":'),
+ contains('404 Not Found'),
+ contains('Make sure "pub serve" is serving the test/ directory.')
+ ]));
+ expect(result.exitCode, equals(1));
} finally {
process.kill();
}
@@ -217,23 +219,27 @@ transformers:
test("gracefully handles pub serve not running for VM tests", () {
var result = runUnittest(['--pub-serve=54321'],
workingDirectory: _sandbox);
- expect(result.stderr, equals('''
-Failed to load "test/my_test.dart":
-Error getting http://localhost:54321/my_test.vm_test.dart: Connection refused
-Make sure "pub serve" is running.
-'''));
- expect(result.exitCode, equals(exit_codes.data));
+ expect(result.stdout, allOf([
+ contains('-1: load error'),
+ contains('''
+ Failed to load "test/my_test.dart":
+ Error getting http://localhost:54321/my_test.vm_test.dart: Connection refused
+ Make sure "pub serve" is running.''')
+ ]));
+ expect(result.exitCode, equals(1));
});
test("gracefully handles pub serve not running for browser tests", () {
var result = runUnittest(['--pub-serve=54321', '-p', 'chrome'],
workingDirectory: _sandbox);
- expect(result.stderr, matches(r'''
-Failed to load "test/my_test\.dart":
-Error getting http://localhost:54321/my_test\.browser_test.dart\.js: Connection refused \(errno \d+\)
-Make sure "pub serve" is running\.
-'''));
- expect(result.exitCode, equals(exit_codes.data));
+ expect(result.stdout, allOf([
+ contains('-1: load error'),
+ contains('Failed to load "test/my_test.dart":'),
+ contains('Error getting http://localhost:54321/my_test.browser_test.dart'
+ '.js: Connection refused (errno '),
+ contains('Make sure "pub serve" is running.')
+ ]));
+ expect(result.exitCode, equals(1));
});
test("gracefully handles a test file not being in test/", () {
@@ -242,8 +248,12 @@ Make sure "pub serve" is running\.
var result = runUnittest(['--pub-serve=54321', 'my_test.dart'],
workingDirectory: _sandbox);
- expect(result.stderr, equals(
- 'Failed to load "my_test.dart": When using "pub serve", all test files '
- 'must be in test/.\n'));
+ expect(result.stdout, allOf([
+ contains('-1: load error'),
+ contains(
+ 'Failed to load "my_test.dart": When using "pub serve", all test '
+ 'files must be in test/.\n')
+ ]));
+ expect(result.exitCode, equals(1));
});
}
« no previous file with comments | « test/runner/loader_test.dart ('k') | test/runner/runner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698