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

Unified Diff: test/codegen/unittest.dart

Issue 1243503007: fixes #221, initial sync*, async, async* implementation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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/codegen/syncstar_yieldstar_test.dart ('k') | test/codegen_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/unittest.dart
diff --git a/test/browser/minitest.dart b/test/codegen/unittest.dart
similarity index 69%
rename from test/browser/minitest.dart
rename to test/codegen/unittest.dart
index 96f0b2fa8c1a89328516a9ebe4ba25eec87f996d..e964b80a38a393def9675266352dc6735c360e19 100644
--- a/test/browser/minitest.dart
+++ b/test/codegen/unittest.dart
@@ -3,30 +3,29 @@
// BSD-style license that can be found in the LICENSE file.
// TODO(jmesserly): replace this with the real package:test.
-// Not possible yet because it uses on async/await which we don't support.
+// Not possible yet due to various bugs we still have.
library minitest;
-import 'dom.dart';
+import 'dart:async';
+import 'package:dom/dom.dart';
-final console = (window as dynamic).console;
+void group(String name, void body()) => (window as dynamic).suite(name, body);
-void group(String name, void body()) {
- console.group(name);
- body();
- console.groupEnd(name);
-}
-
-void test(String name, void body(), {String skip}) {
+void test(String name, body(), {String skip}) {
if (skip != null) {
- console.warn('SKIP $name: $skip');
+ print('SKIP $name: $skip');
return;
}
- console.log(name);
- try {
- body();
- } catch(e) {
- console.error(e);
- }
+ (window as dynamic).test(name, (done) {
+ _finishTest(f) {
+ if (f is Future) {
+ f.then(_finishTest);
+ } else {
+ done();
+ }
+ }
+ _finishTest(body());
+ });
}
void expect(Object actual, matcher) {
@@ -36,6 +35,10 @@ void expect(Object actual, matcher) {
}
}
+void fail(String message) {
+ throw 'TestFailure: ' + message;
+}
+
Matcher equals(Object expected) {
return (actual) {
if (expected is List && actual is List) {
@@ -57,10 +60,13 @@ Matcher isNot(matcher) {
return (actual) => !matcher(actual);
}
+bool isTrue(actual) => actual == true;
bool isNull(actual) => actual == null;
final Matcher isNotNull = isNot(isNull);
bool isRangeError(actual) => actual is RangeError;
bool isNoSuchMethodError(actual) => actual is NoSuchMethodError;
+Matcher lessThan(expected) => (actual) => actual < expected;
+Matcher greaterThan(expected) => (actual) => actual > expected;
Matcher throwsA(matcher) {
if (matcher is! Matcher) matcher = equals(matcher);
« no previous file with comments | « test/codegen/syncstar_yieldstar_test.dart ('k') | test/codegen_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698