Index: test/test_utils.dart |
diff --git a/test/test_utils.dart b/test/test_utils.dart |
index fb342a49a79477deb0a983b02428c58d646d4ecc..ed3e1c1ebee047e6119f92e9105f4dcb81933afe 100644 |
--- a/test/test_utils.dart |
+++ b/test/test_utils.dart |
@@ -33,3 +33,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; |
+} |