| Index: test/test_utils.dart
|
| diff --git a/test/test_utils.dart b/test/test_utils.dart
|
| index fb342a49a79477deb0a983b02428c58d646d4ecc..b1a9756ed62c86e401ca1411405581af9c712936 100644
|
| --- a/test/test_utils.dart
|
| +++ b/test/test_utils.dart
|
| @@ -4,6 +4,8 @@
|
|
|
| library matcher.test_utils;
|
|
|
| +import 'dart:collection';
|
| +
|
| import 'package:unittest/unittest.dart';
|
|
|
| void shouldFail(value, Matcher matcher, expected) {
|
| @@ -33,3 +35,52 @@ doesNotThrow() {}
|
| doesThrow() {
|
| throw 'X';
|
| }
|
| +
|
| +class Widget {
|
| + int price;
|
| +}
|
| +
|
| +class HasPrice extends CustomMatcher {
|
| + HasPrice(matcher) : super("Widget with a price that is", "price", matcher);
|
| + featureValueOf(actual) => actual.price;
|
| +}
|
| +
|
| +class SimpleIterable extends IterableBase<int> {
|
| + final int count;
|
| +
|
| + SimpleIterable(this.count);
|
| +
|
| + bool contains(int val) => count < val ? false : true;
|
| +
|
| + bool any(bool f(element)) {
|
| + for (var i = 0; i <= count; i++) {
|
| + if (f(i)) return true;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| + String toString() => "<[$count]>";
|
| +
|
| + Iterator get iterator {
|
| + return new _SimpleIterator(count);
|
| + }
|
| +}
|
| +
|
| +class _SimpleIterator implements Iterator<int> {
|
| + int _count;
|
| + int _current;
|
| +
|
| + _SimpleIterator(this._count);
|
| +
|
| + bool moveNext() {
|
| + if (_count > 0) {
|
| + _current = _count;
|
| + _count--;
|
| + return true;
|
| + }
|
| + _current = null;
|
| + return false;
|
| + }
|
| +
|
| + int get current => _current;
|
| +}
|
|
|