| 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..9097ca6fd1f7518df025321c10c32cb108b1430b 100644
|
| --- a/pkg/unittest/test/expect_async_test.dart
|
| +++ b/pkg/unittest/test/expect_async_test.dart
|
| @@ -2,96 +2,101 @@
|
| // 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';
|
| +import 'utils.dart';
|
|
|
| -var testFunction = (TestConfiguration testConfig) {
|
| - test('expectAsync zero params', () {
|
| - _defer(expectAsync(() {
|
| - ++testConfig.count;
|
| - }));
|
| - });
|
| +void main() => initTests(_test);
|
|
|
| - test('expectAsync 1 param', () {
|
| - var func = expectAsync((arg) {
|
| - expect(arg, 0);
|
| - ++testConfig.count;
|
| +void _test(message) {
|
| + initMetatest(message);
|
| +
|
| + var count = 0;
|
| +
|
| + expectTestResults('expect async test', () {
|
| + test('expectAsync zero params', () {
|
| + defer(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;
|
| + });
|
| + defer(() => 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;
|
| + });
|
| + defer(() => 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;
|
| + defer(() => 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;
|
| + });
|
|
|
| - test('two of two optional positional args', () {
|
| - var func = expectAsync(([arg0 = true, arg1 = true]) {
|
| - expect(arg0, isFalse);
|
| - expect(arg1, isNull);
|
| - ++testConfig.count;
|
| + defer(() => func(false));
|
| });
|
|
|
| - _defer(() => func(false, null));
|
| - });
|
| -};
|
| + test('two of two optional positional args', () {
|
| + var func = expectAsync(([arg0 = true, arg1 = true]) {
|
| + expect(arg0, isFalse);
|
| + expect(arg1, isNull);
|
| + ++count;
|
| + });
|
|
|
| -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:';
|
| + defer(() => func(false, null));
|
| + });
|
| +
|
| + test('verify count', () {
|
| + expect(count, 8);
|
| + });
|
| + }, new List.filled(9, {'result': 'pass' }));
|
| +}
|
|
|