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

Side by Side Diff: pkg/unittest/lib/src/group_context.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/lib/src/configuration.dart ('k') | pkg/unittest/lib/src/simple_configuration.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 part of unittest;
2
3 /// Setup and teardown functions for a group and its parents, the latter
4 /// for chaining.
5 class _GroupContext {
6 final _GroupContext parent;
7
8 /// Description text of the current test group.
9 final String _name;
10
11 /// Setup function called before each test in a group.
12 Function _testSetup;
13
14 get testSetup => _testSetup;
15
16 get parentSetup => (parent == null) ? null : parent.testSetup;
17
18 set testSetup(Function setup) {
19 var preSetup = parentSetup;
20 if (preSetup == null) {
21 _testSetup = setup;
22 } else {
23 _testSetup = () {
24 var f = preSetup();
25 if (f is Future) {
26 return f.then((_) => setup());
27 } else {
28 return setup();
29 }
30 };
31 }
32 }
33
34 /// Teardown function called after each test in a group.
35 Function _testTeardown;
36
37 get testTeardown => _testTeardown;
38
39 get parentTeardown => (parent == null) ? null : parent.testTeardown;
40
41 set testTeardown(Function teardown) {
42 var postTeardown = parentTeardown;
43 if (postTeardown == null) {
44 _testTeardown = teardown;
45 } else {
46 _testTeardown = () {
47 var f = teardown();
48 if (f is Future) {
49 return f.then((_) => postTeardown());
50 } else {
51 return postTeardown();
52 }
53 };
54 }
55 }
56
57 String get fullName => (parent == null || parent == _environment.rootContext)
58 ? _name
59 : "${parent.fullName}$groupSep$_name";
60
61 _GroupContext([this.parent, this._name = '']) {
62 _testSetup = parentSetup;
63 _testTeardown = parentTeardown;
64 }
65 }
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/configuration.dart ('k') | pkg/unittest/lib/src/simple_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698