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

Side by Side Diff: pkg/unittest/test/expect_async_test.dart

Issue 807193003: Re-apply "Remove unittest and matcher from the repo." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library unittest.expect_async_test;
6
7 import 'dart:async';
8
9 import 'package:metatest/metatest.dart';
10 import 'package:unittest/unittest.dart';
11
12 void main() => initTests(_test);
13
14 void _test(message) {
15 initMetatest(message);
16
17 var count = 0;
18
19 expectTestsPass('expect async test', () {
20 test('expectAsync zero params', () {
21 new Future.sync(expectAsync(() {
22 ++count;
23 }));
24 });
25
26 test('expectAsync 1 param', () {
27 var func = expectAsync((arg) {
28 expect(arg, 0);
29 ++count;
30 });
31 new Future.sync(() => func(0));
32 });
33
34 test('expectAsync 2 param', () {
35 var func = expectAsync((arg0, arg1) {
36 expect(arg0, 0);
37 expect(arg1, 1);
38 ++count;
39 });
40 new Future.sync(() => func(0, 1));
41 });
42
43 test('single arg to Future.catchError', () {
44 var func = expectAsync((error) {
45 expect(error, isStateError);
46 ++count;
47 });
48
49 new Future(() {
50 throw new StateError('test');
51 }).catchError(func);
52 });
53
54 test('2 args to Future.catchError', () {
55 var func = expectAsync((error, stack) {
56 expect(error, isStateError);
57 expect(stack is StackTrace, isTrue);
58 ++count;
59 });
60
61 new Future(() {
62 throw new StateError('test');
63 }).catchError(func);
64 });
65
66 test('zero of two optional positional args', () {
67 var func = expectAsync(([arg0 = true, arg1 = true]) {
68 expect(arg0, isTrue);
69 expect(arg1, isTrue);
70 ++count;
71 });
72
73 new Future.sync(() => func());
74 });
75
76 test('one of two optional positional args', () {
77 var func = expectAsync(([arg0 = true, arg1 = true]) {
78 expect(arg0, isFalse);
79 expect(arg1, isTrue);
80 ++count;
81 });
82
83 new Future.sync(() => func(false));
84 });
85
86 test('two of two optional positional args', () {
87 var func = expectAsync(([arg0 = true, arg1 = true]) {
88 expect(arg0, isFalse);
89 expect(arg1, isNull);
90 ++count;
91 });
92
93 new Future.sync(() => func(false, null));
94 });
95
96 test('verify count', () {
97 expect(count, 8);
98 });
99 });
100 }
OLDNEW
« 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