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

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

Issue 814953002: Remove unittest and matcher from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/missing_tick_test.dart ('k') | pkg/unittest/test/protect_async_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.nested_groups_setup_teardown_test;
6
7 import 'dart:async';
8
9 import 'package:unittest/unittest.dart';
10
11 import 'package:metatest/metatest.dart';
12
13 void main() => initTests(_test);
14
15 void _test(message) {
16 initMetatest(message);
17
18 expectTestsPass('nested groups setup/teardown', () {
19 StringBuffer s = new StringBuffer();
20 group('level 1', () {
21 setUp(makeDelayedSetup(1, s));
22 group('level 2', () {
23 setUp(makeImmediateSetup(2, s));
24 tearDown(makeDelayedTeardown(2, s));
25 group('level 3', () {
26 group('level 4', () {
27 setUp(makeDelayedSetup(4, s));
28 tearDown(makeImmediateTeardown(4, s));
29 group('level 5', () {
30 setUp(makeImmediateSetup(5, s));
31 group('level 6', () {
32 tearDown(makeDelayedTeardown(6, s));
33 test('inner', () {});
34 });
35 });
36 });
37 });
38 });
39 });
40 test('after nest', () {
41 expect(s.toString(), "l1 U l2 U l4 U l5 U l6 D l4 D l2 D ");
42 });
43 });
44 }
45
46
47 Function makeDelayedSetup(int index, StringBuffer s) => () {
48 return new Future.delayed(new Duration(milliseconds: 1), () {
49 s.write('l$index U ');
50 });
51 };
52
53 Function makeDelayedTeardown(int index, StringBuffer s) => () {
54 return new Future.delayed(new Duration(milliseconds: 1), () {
55 s.write('l$index D ');
56 });
57 };
58
59 Function makeImmediateSetup(int index, StringBuffer s) => () {
60 s.write('l$index U ');
61 };
62
63 Function makeImmediateTeardown(int index, StringBuffer s) => () {
64 s.write('l$index D ');
65 };
OLDNEW
« no previous file with comments | « pkg/unittest/test/missing_tick_test.dart ('k') | pkg/unittest/test/protect_async_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698