| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library unittestTests; | 5 library unittestTests; |
| 6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 part 'test_utils.dart'; | 9 part 'test_utils.dart'; |
| 10 | 10 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 "but: was <[0]> with length of <1>."); | 231 "but: was <[0]> with length of <1>."); |
| 232 | 232 |
| 233 b.add(0); | 233 b.add(0); |
| 234 shouldFail(b, hasLength(1), | 234 shouldFail(b, hasLength(1), |
| 235 "Expected: an object with length of <1> " | 235 "Expected: an object with length of <1> " |
| 236 "but: was <[0, 0]> with length of <2>."); | 236 "but: was <[0, 0]> with length of <2>."); |
| 237 shouldPass(b, hasLength(2)); | 237 shouldPass(b, hasLength(2)); |
| 238 }); | 238 }); |
| 239 | 239 |
| 240 test('scalar type mismatch', () { | 240 test('scalar type mismatch', () { |
| 241 shouldFail('error', equals(5.0), | 241 shouldFail('error', equals(5.1), |
| 242 matches("^Expected: <5\.0>" | 242 matches("^Expected: <5\.1>" |
| 243 " but: was .*:'error' \\(not type .*\\)\.\$")); | 243 " but: was .*:'error' \\(not type .*\\)\.\$")); |
| 244 }); | 244 }); |
| 245 | 245 |
| 246 test('nested type mismatch', () { | 246 test('nested type mismatch', () { |
| 247 shouldFail(['error'], equals([5.0]), | 247 shouldFail(['error'], equals([5.1]), |
| 248 matches(r"^Expected: <\[5\.0\]>" | 248 matches(r"^Expected: <\[5\.1\]>" |
| 249 " but: expected double:<5\.0> " | 249 " but: expected double:<5\.1> " |
| 250 "but was .*:'error' mismatch at position 0\.\$")); | 250 "but was .*:'error' mismatch at position 0\.\$")); |
| 251 }); | 251 }); |
| 252 | 252 |
| 253 test('doubly-nested type mismatch', () { | 253 test('doubly-nested type mismatch', () { |
| 254 shouldFail([['error']], equals([[5.0]]), | 254 shouldFail([['error']], equals([[5.1]]), |
| 255 matches(r"^Expected: <\[\[5\.0\]\]>" | 255 matches(r"^Expected: <\[\[5\.1\]\]>" |
| 256 " but: expected double:<5\.0> " | 256 " but: expected double:<5\.1> " |
| 257 "but was .*:'error' mismatch at position 0 " | 257 "but was .*:'error' mismatch at position 0 " |
| 258 "mismatch at position 0\.\$")); | 258 "mismatch at position 0\.\$")); |
| 259 }); | 259 }); |
| 260 }); | 260 }); |
| 261 | 261 |
| 262 group('Numeric Matchers', () { | 262 group('Numeric Matchers', () { |
| 263 | 263 |
| 264 test('greaterThan', () { | 264 test('greaterThan', () { |
| 265 shouldPass(10, greaterThan(9)); | 265 shouldPass(10, greaterThan(9)); |
| 266 shouldFail(9, greaterThan(10), | 266 shouldFail(9, greaterThan(10), |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 var w = new Widget(); | 708 var w = new Widget(); |
| 709 w.price = 10; | 709 w.price = 10; |
| 710 shouldPass(w, new HasPrice(greaterThan(0))); | 710 shouldPass(w, new HasPrice(greaterThan(0))); |
| 711 shouldFail(w, new HasPrice(greaterThan(10)), | 711 shouldFail(w, new HasPrice(greaterThan(10)), |
| 712 'Expected: Widget with a price that is a value greater than <10> ' | 712 'Expected: Widget with a price that is a value greater than <10> ' |
| 713 'but: price was <10>.'); | 713 'but: price was <10>.'); |
| 714 }); | 714 }); |
| 715 }); | 715 }); |
| 716 } | 716 } |
| 717 | 717 |
| OLD | NEW |