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

Unified Diff: pkg/unittest/test/test_utils.dart

Issue 15492003: Split out unittest tests whose behavior differs in minified mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
Index: pkg/unittest/test/test_utils.dart
diff --git a/pkg/unittest/test/test_utils.dart b/pkg/unittest/test/test_utils.dart
index d783665df19e784eb2f760bb88a243d1bdff859b..37ab45601c79ffb8a9774e4ee196deb3a1ab3386 100644
--- a/pkg/unittest/test/test_utils.dart
+++ b/pkg/unittest/test/test_utils.dart
@@ -2,7 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of unittestTests;
+library test_utils;
+
+import 'dart:collection';
+
+import 'package:unittest/unittest.dart';
+
+import 'dart:async';
int errorCount;
String errorString;
@@ -58,3 +64,69 @@ void shouldPass(value, Matcher matcher, {bool isAsync: false}) {
afterTest();
}
}
+
+doesNotThrow() {}
+doesThrow() { throw 'X'; }
+
+class PrefixMatcher extends BaseMatcher {
+ final String _prefix;
+ const PrefixMatcher(this._prefix);
+ bool matches(item, MatchState matchState) {
+ return item is String &&
+ (collapseWhitespace(item)).startsWith(collapseWhitespace(_prefix));
+ }
+
+ Description describe(Description description) =>
+ description.add('a string starting with ').
+ addDescriptionOf(collapseWhitespace(_prefix)).
+ add(' ignoring whitespace');
+}
+
+class Widget {
gram 2013/05/20 22:35:58 Can you move everything from Widget down into a fi
nweiz 2013/05/20 23:29:06 Done.
+ 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 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 _count;
+ int _current;
+
+ SimpleIterator(this._count);
+
+ bool moveNext() {
+ if (_count > 0) {
+ _current = _count;
+ _count--;
+ return true;
+ }
+ _current = null;
+ return false;
+ }
+
+ get current => _current;
+}

Powered by Google App Engine
This is Rietveld 408576698