Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: test/test_utils.dart

Issue 935923002: Re-add minified/unminified tests. (Closed) Base URL: git@github.com:dart-lang/matcher@master
Patch Set: Code review changes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/minified_test.dart ('k') | test/unminified_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « test/minified_test.dart ('k') | test/unminified_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698