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

Unified Diff: pkg/scheduled_test/test/scheduled_server_test.dart

Issue 12678011: Miscellaneous small improvements for scheduled_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Guard against issue 9151 more thoroughly. Created 7 years, 9 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 | « pkg/scheduled_test/lib/src/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/test/scheduled_server_test.dart
diff --git a/pkg/scheduled_test/test/scheduled_server_test.dart b/pkg/scheduled_test/test/scheduled_server_test.dart
index 5fc78120a3866f592ca33b2f4bb61d4d88370936..aeb654f9a7e34503587aaf23b51e3f0db8100b52 100644
--- a/pkg/scheduled_test/test/scheduled_server_test.dart
+++ b/pkg/scheduled_test/test/scheduled_server_test.dart
@@ -35,10 +35,18 @@ void main() {
test('test 2', () {
expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(2));
+ // TODO(nweiz): There can be three errors due to issue 9151. The
+ // HttpParserException is reported without a stack trace, and so when it's
+ // wrapped twice it registers as a different exception each time (because
+ // it's given an ad-hoc stack trace). Always expect two exceptions when
+ // issue 9151 is fixed.
+ expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' received GET /hello "
"when no more requests were expected."));
expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ if (errors.length > 2) {
+ expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ }
});
}, passing: ['test 2']);
@@ -99,11 +107,19 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(2));
+ // TODO(nweiz): There can be three errors due to issue 9151. The
+ // HttpParserException is reported without a stack trace, and so when it's
+ // wrapped twice it registers as a different exception each time (because
+ // it's given an ad-hoc stack trace). Always expect two exceptions when
+ // issue 9151 is fixed.
+ expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' received GET /hello "
"earlier than expected."));
expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ if (errors.length > 2) {
+ expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ }
+ expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
});
}, passing: ['test 2']);
@@ -147,11 +163,18 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(2));
+ // TODO(nweiz): There can be three errors due to issue 9151. The
+ // HttpParserException is reported without a stack trace, and so when it's
+ // wrapped twice it registers as a different exception each time (because
+ // it's given an ad-hoc stack trace). Always expect two exceptions when
+ // issue 9151 is fixed.
+ expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' expected GET "
"/goodbye, but got GET /hello."));
expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ if (errors.length > 2) {
+ expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ }
});
}, passing: ['test 2']);
@@ -173,11 +196,18 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(2));
+ // TODO(nweiz): There can be three errors due to issue 9151. The
+ // HttpParserException is reported without a stack trace, and so when it's
+ // wrapped twice it registers as a different exception each time (because
+ // it's given an ad-hoc stack trace). Always expect two exceptions when
+ // issue 9151 is fixed.
+ expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' expected GET "
"/hello, but got HEAD /hello."));
expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ if (errors.length > 2) {
+ expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ }
});
}, passing: ['test 2']);
@@ -271,11 +301,18 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(2));
+ // TODO(nweiz): There can be three errors due to issue 9151. The
+ // HttpParserException is reported without a stack trace, and so when it's
+ // wrapped twice it registers as a different exception each time (because
+ // it's given an ad-hoc stack trace). Always expect two exceptions when
+ // issue 9151 is fixed.
+ expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' received GET "
"/hello/3 when no more requests were expected."));
expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ if (errors.length > 2) {
+ expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ }
});
}, passing: ['test 2']);
@@ -296,10 +333,17 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(2));
+ // TODO(nweiz): There can be three errors due to issue 9151. The
+ // HttpParserException is reported without a stack trace, and so when it's
+ // wrapped twice it registers as a different exception each time (because
+ // it's given an ad-hoc stack trace). Always expect two exceptions when
+ // issue 9151 is fixed.
+ expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals('oh no'));
expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ if (errors.length > 2) {
+ expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ }
});
}, passing: ['test 2']);
}
« no previous file with comments | « pkg/scheduled_test/lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698