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

Unified Diff: pkg/expect/lib/minitest.dart

Issue 2419863002: Remove uses of unittest in the HTML tests where possible. (Closed)
Patch Set: Remove TODO. Created 4 years, 2 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/expect/lib/minitest.dart
diff --git a/pkg/expect/lib/minitest.dart b/pkg/expect/lib/minitest.dart
index 980544c2839a162c9591f603b4f13a31cbd18774..d3057c2fa5b61bf7689f43a866d9aed6f1ebe063 100644
--- a/pkg/expect/lib/minitest.dart
+++ b/pkg/expect/lib/minitest.dart
@@ -161,6 +161,20 @@ Object same(Object value) => new _Expectation((actual) {
Expect.identical(value, actual);
});
+Object closeTo(num value, num tolerance) => new _Expectation((actual) {
+ Expect.approxEquals(value, actual, tolerance);
+ });
+
+/// Succeeds if the actual value is any of the given strings. Unlike matcher's
+/// [anyOf], this only works with strings and requires an explicit list.
+Object anyOf(List<String> expected) => new _Expectation((actual) {
+ for (var string in expected) {
+ if (actual == string) return;
+ }
+
+ fail("Expected $actual to be one of $expected.");
+ });
+
/// One level of group() nesting to track an optional [setUp()] and [tearDown()]
/// function for the group.
///

Powered by Google App Engine
This is Rietveld 408576698