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

Unified Diff: test/frontend/matcher/throws_test.dart

Issue 1180613008: Fix prints/throws tests on the latest dart2js. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 6 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/frontend/matcher/prints_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/frontend/matcher/throws_test.dart
diff --git a/test/frontend/matcher/throws_test.dart b/test/frontend/matcher/throws_test.dart
index 2e2d7c447952050e4060f36182fce860d9c7e943..5b3e099aa0154795cce1fe40ea962e5e121032d7 100644
--- a/test/frontend/matcher/throws_test.dart
+++ b/test/frontend/matcher/throws_test.dart
@@ -16,14 +16,18 @@ void main() {
});
test("with a function that doesn't throw", () async {
+ var closure = () {};
var liveTest = await runTestBody(() {
- expect(() {}, throws);
+ expect(closure, throws);
});
- expectTestFailed(liveTest,
- "Expected: throws\n"
- " Actual: <$closureString>\n"
- " Which: did not throw\n");
+ expectTestFailed(liveTest, allOf([
+ startsWith(
+ "Expected: throws\n"
+ " Actual: <"),
+ endsWith(">\n"
+ " Which: did not throw\n")
+ ]));
});
test("with a non-function", () async {
@@ -49,14 +53,18 @@ void main() {
});
test("with a function that doesn't throw", () async {
+ var closure = () {};
var liveTest = await runTestBody(() {
- expect(() {}, throwsA('oh no'));
+ expect(closure, throwsA('oh no'));
});
- expectTestFailed(liveTest,
- "Expected: throws 'oh no'\n"
- " Actual: <$closureString>\n"
- " Which: did not throw\n");
+ expectTestFailed(liveTest, allOf([
+ startsWith(
+ "Expected: throws 'oh no'\n"
+ " Actual: <"),
+ endsWith(">\n"
+ " Which: did not throw\n")
+ ]));
});
test("with a non-function", () async {
@@ -75,10 +83,13 @@ void main() {
expect(() => throw 'aw dang', throwsA('oh no'));
});
- expectTestFailed(liveTest,
- "Expected: throws 'oh no'\n"
- " Actual: <$closureString>\n"
- " Which: threw 'aw dang'\n");
+ expectTestFailed(liveTest, allOf([
+ startsWith(
+ "Expected: throws 'oh no'\n"
+ " Actual: <"),
+ endsWith(">\n"
+ " Which: threw 'aw dang'\n")
+ ]));
});
});
});
@@ -131,10 +142,13 @@ void main() {
expect(new Future.error('aw dang'), throwsA('oh no'));
});
- expectTestFailed(liveTest, startsWith(
- "Expected: throws 'oh no'\n"
- " Actual: <$closureString>\n"
- " Which: threw 'aw dang'\n"));
+ expectTestFailed(liveTest, allOf([
+ startsWith(
+ "Expected: throws 'oh no'\n"
+ " Actual: <"),
+ contains(">\n"
+ " Which: threw 'aw dang'\n")
+ ]));
});
test("won't let the test end until the Future completes", () {
« no previous file with comments | « test/frontend/matcher/prints_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698