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

Side by Side Diff: pkg/scheduled_test/test/descriptor/async_test.dart

Issue 812253002: Delete a bunch of packages that are now on GitHub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Un-delete http 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/scheduled_test/pubspec.yaml ('k') | pkg/scheduled_test/test/descriptor/directory_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 import 'package:metatest/metatest.dart';
6 import 'package:scheduled_test/descriptor.dart' as d;
7 import 'package:scheduled_test/scheduled_test.dart';
8
9 import 'utils.dart';
10
11 void main() => initTests(_test);
12
13 void _test(message) {
14 initMetatest(message);
15
16 setUpTimeout();
17
18 expectTestsPass("async().create() forwards to file().create", () {
19 test('test', () {
20 scheduleSandbox();
21
22 d.async(pumpEventQueue().then((_) {
23 return d.file('name.txt', 'contents');
24 })).create();
25
26 d.file('name.txt', 'contents').validate();
27 });
28 });
29
30 expectTestsPass("async().create() forwards to directory().create", () {
31 test('test', () {
32 scheduleSandbox();
33
34 d.async(pumpEventQueue().then((_) {
35 return d.dir('dir', [
36 d.file('file1.txt', 'contents1'),
37 d.file('file2.txt', 'contents2')
38 ]);
39 })).create();
40
41 d.dir('dir', [
42 d.file('file1.txt', 'contents1'),
43 d.file('file2.txt', 'contents2')
44 ]).validate();
45 });
46 });
47
48 expectTestsPass("async().validate() forwards to file().validate", () {
49 test('test', () {
50 scheduleSandbox();
51
52 d.file('name.txt', 'contents').create();
53
54 d.async(pumpEventQueue().then((_) {
55 return d.file('name.txt', 'contents');
56 })).validate();
57 });
58 });
59
60 expectTestsPass("async().validate() fails if file().validate fails", () {
61 var errors;
62 test('test 1', () {
63 scheduleSandbox();
64
65 currentSchedule.onException.schedule(() {
66 errors = currentSchedule.errors;
67 });
68
69 d.async(pumpEventQueue().then((_) {
70 return d.file('name.txt', 'contents');
71 })).validate();
72 });
73
74 test('test 2', () {
75 expect(errors.single, new isInstanceOf<ScheduleError>());
76 expect(errors.single.error.toString(),
77 matches(r"^File not found: '[^']+[\\/]name\.txt'\.$"));
78 });
79 }, passing: ['test 2']);
80
81 expectTestsPass("async().validate() forwards to directory().validate", () {
82 test('test', () {
83 scheduleSandbox();
84
85 d.dir('dir', [
86 d.file('file1.txt', 'contents1'),
87 d.file('file2.txt', 'contents2')
88 ]).create();
89
90 d.async(pumpEventQueue().then((_) {
91 return d.dir('dir', [
92 d.file('file1.txt', 'contents1'),
93 d.file('file2.txt', 'contents2')
94 ]);
95 })).validate();
96 });
97 });
98
99 expectTestsPass("async().create() fails if directory().create fails", () {
100 var errors;
101 test('test 1', () {
102 scheduleSandbox();
103
104 currentSchedule.onException.schedule(() {
105 errors = currentSchedule.errors;
106 });
107
108 d.async(pumpEventQueue().then((_) {
109 return d.dir('dir', [
110 d.file('file1.txt', 'contents1'),
111 d.file('file2.txt', 'contents2')
112 ]);
113 })).validate();
114 });
115
116 test('test 2', () {
117 expect(errors.single, new isInstanceOf<ScheduleError>());
118 expect(errors.single.error.toString(),
119 matches(r"^Directory not found: '[^']+[\\/]dir'\.$"));
120 });
121 }, passing: ['test 2']);
122 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/pubspec.yaml ('k') | pkg/scheduled_test/test/descriptor/directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698