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

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

Issue 524153002: Sharing metatest logic between unittest and scheduled_test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: status fixes Created 6 years, 3 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 | « pkg/unittest/test/expect_async_args_test.dart ('k') | pkg/unittest/test/group_name_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/test/expect_async_test.dart
diff --git a/pkg/unittest/test/expect_async_test.dart b/pkg/unittest/test/expect_async_test.dart
index cd771b14f7e8e6c21da07866992f5d73607a1f22..844e44b0f6040f6b6435a1d09b8118579d1539ab 100644
--- a/pkg/unittest/test/expect_async_test.dart
+++ b/pkg/unittest/test/expect_async_test.dart
@@ -2,96 +2,99 @@
// 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.
-library unittestTest;
+library unittest.expect_async_test;
import 'dart:async';
-import 'dart:isolate';
+import 'package:metatest/metatest.dart';
import 'package:unittest/unittest.dart';
-part 'utils.dart';
+void main() => initTests(_test);
-var testFunction = (TestConfiguration testConfig) {
- test('expectAsync zero params', () {
- _defer(expectAsync(() {
- ++testConfig.count;
- }));
- });
+void _test(message) {
+ initMetatest(message);
+
+ var count = 0;
- test('expectAsync 1 param', () {
- var func = expectAsync((arg) {
- expect(arg, 0);
- ++testConfig.count;
+ expectTestsPass('expect async test', () {
+ test('expectAsync zero params', () {
+ new Future.sync(expectAsync(() {
+ ++count;
+ }));
});
- _defer(() => func(0));
- });
- test('expectAsync 2 param', () {
- var func = expectAsync((arg0, arg1) {
- expect(arg0, 0);
- expect(arg1, 1);
- ++testConfig.count;
+ test('expectAsync 1 param', () {
+ var func = expectAsync((arg) {
+ expect(arg, 0);
+ ++count;
+ });
+ new Future.sync(() => func(0));
});
- _defer(() => func(0, 1));
- });
- test('single arg to Future.catchError', () {
- var func = expectAsync((error) {
- expect(error, isStateError);
- ++testConfig.count;
+ test('expectAsync 2 param', () {
+ var func = expectAsync((arg0, arg1) {
+ expect(arg0, 0);
+ expect(arg1, 1);
+ ++count;
+ });
+ new Future.sync(() => func(0, 1));
});
- new Future(() {
- throw new StateError('test');
- }).catchError(func);
- });
+ test('single arg to Future.catchError', () {
+ var func = expectAsync((error) {
+ expect(error, isStateError);
+ ++count;
+ });
- test('2 args to Future.catchError', () {
- var func = expectAsync((error, stack) {
- expect(error, isStateError);
- expect(stack is StackTrace, isTrue);
- ++testConfig.count;
+ new Future(() {
+ throw new StateError('test');
+ }).catchError(func);
});
- new Future(() {
- throw new StateError('test');
- }).catchError(func);
- });
+ test('2 args to Future.catchError', () {
+ var func = expectAsync((error, stack) {
+ expect(error, isStateError);
+ expect(stack is StackTrace, isTrue);
+ ++count;
+ });
- test('zero of two optional positional args', () {
- var func = expectAsync(([arg0 = true, arg1 = true]) {
- expect(arg0, isTrue);
- expect(arg1, isTrue);
- ++testConfig.count;
+ new Future(() {
+ throw new StateError('test');
+ }).catchError(func);
});
- _defer(() => func());
- });
+ test('zero of two optional positional args', () {
+ var func = expectAsync(([arg0 = true, arg1 = true]) {
+ expect(arg0, isTrue);
+ expect(arg1, isTrue);
+ ++count;
+ });
- test('one of two optional positional args', () {
- var func = expectAsync(([arg0 = true, arg1 = true]) {
- expect(arg0, isFalse);
- expect(arg1, isTrue);
- ++testConfig.count;
+ new Future.sync(() => func());
});
- _defer(() => func(false));
- });
+ test('one of two optional positional args', () {
+ var func = expectAsync(([arg0 = true, arg1 = true]) {
+ expect(arg0, isFalse);
+ expect(arg1, isTrue);
+ ++count;
+ });
+
+ new Future.sync(() => func(false));
+ });
+
+ test('two of two optional positional args', () {
+ var func = expectAsync(([arg0 = true, arg1 = true]) {
+ expect(arg0, isFalse);
+ expect(arg1, isNull);
+ ++count;
+ });
- test('two of two optional positional args', () {
- var func = expectAsync(([arg0 = true, arg1 = true]) {
- expect(arg0, isFalse);
- expect(arg1, isNull);
- ++testConfig.count;
+ new Future.sync(() => func(false, null));
});
- _defer(() => func(false, null));
+ test('verify count', () {
+ expect(count, 8);
+ });
});
-};
-
-final expected = '8:0:0:8:8:::null:expectAsync zero params:'
- ':expectAsync 1 param::expectAsync 2 param:'
- ':single arg to Future.catchError::2 args to Future.catchError:'
- ':zero of two optional positional args:'
- ':one of two optional positional args:'
- ':two of two optional positional args:';
+}
« no previous file with comments | « pkg/unittest/test/expect_async_args_test.dart ('k') | pkg/unittest/test/group_name_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698