| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// A light-weight replacement for package:unittest. This library runs tests | 5 /// A light-weight replacement for package:unittest. This library runs tests |
| 6 /// synchronously, and avoids using reflection. | 6 /// synchronously, and avoids using reflection. |
| 7 library light_unittest; | 7 library light_unittest; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return new Expectation((actual) => Expect.stringEquals(expected, actual)); | 49 return new Expectation((actual) => Expect.stringEquals(expected, actual)); |
| 50 } else { | 50 } else { |
| 51 return new Expectation((actual) => Expect.equals(expected, actual)); | 51 return new Expectation((actual) => Expect.equals(expected, actual)); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 get throws => new Expectation((actual) => Expect.throws(actual)); | 55 get throws => new Expectation((actual) => Expect.throws(actual)); |
| 56 | 56 |
| 57 get isTrue => new Expectation((actual) => Expect.isTrue(actual)); | 57 get isTrue => new Expectation((actual) => Expect.isTrue(actual)); |
| 58 | 58 |
| 59 expectAsync1(then) { | 59 expectAsync(then) { |
| 60 asyncStart(); | 60 asyncStart(); |
| 61 return (x) { | 61 return (x) { |
| 62 // 'then(x)' may call 'asyncStart()', so we first need to execute it, before | 62 // 'then(x)' may call 'asyncStart()', so we first need to execute it, before |
| 63 // we can call 'asyncEnd()'. | 63 // we can call 'asyncEnd()'. |
| 64 var result = then(x); | 64 var result = then(x); |
| 65 asyncEnd(); | 65 asyncEnd(); |
| 66 return result; | 66 return result; |
| 67 }; | 67 }; |
| 68 } | 68 } |
| OLD | NEW |