Chromium Code Reviews| Index: lib/core/expect.dart |
| diff --git a/lib/core/expect.dart b/lib/core/expect.dart |
| index adf0604666f3101ab70c40f497ce1671d2d7be1d..b26ddc53a99420b95087dcf4e30863150d3eb36d 100644 |
| --- a/lib/core/expect.dart |
| +++ b/lib/core/expect.dart |
| @@ -264,13 +264,16 @@ class Expect { |
| String reason = null]) { |
| try { |
| f(); |
| - } catch (e) { |
| + } catch (e, s) { |
| if (check !== null) { |
| - Expect.isTrue(check(e)); |
| + if (!check(e)) { |
| + String msg = reason == null ? "" : reason; |
|
floitsch
2012/11/01 12:11:39
why not just change "reason" to have a default val
Lasse Reichstein Nielsen
2012/11/01 13:39:09
I believe I have seen places where one check is ne
|
| + _fail("Expect.throws($msg): Unexpected '$e'\n$s"); |
| + } |
| } |
| return; |
| } |
| - String msg = _getMessage(reason); |
| + String msg = reason == null ? "" : reason; |
| _fail('Expect.throws($msg) fails'); |
| } |