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

Side by Side Diff: pkg/scheduled_test/test/scheduled_process_test.dart

Issue 12735002: Remove debugging prints and comment out a few more tests in pkg/scheduled_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months 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/lib/scheduled_process.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library scheduled_process_test; 5 library scheduled_process_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:pathos/path.dart' as path; 10 import 'package:pathos/path.dart' as path;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 test('test', () { 161 test('test', () {
162 var process = startDartProcess(r'print("hello\n\nworld"); print("hi");'); 162 var process = startDartProcess(r'print("hello\n\nworld"); print("hi");');
163 expect(process.nextLine(), completion(equals('hello'))); 163 expect(process.nextLine(), completion(equals('hello')));
164 expect(process.nextLine(), completion(equals(''))); 164 expect(process.nextLine(), completion(equals('')));
165 expect(process.nextLine(), completion(equals('world'))); 165 expect(process.nextLine(), completion(equals('world')));
166 expect(process.nextLine(), completion(equals('hi'))); 166 expect(process.nextLine(), completion(equals('hi')));
167 process.shouldExit(0); 167 process.shouldExit(0);
168 }); 168 });
169 }); 169 });
170 170
171 expectTestsPass("nextLine throws an error if there's no more stdout", () { 171 // TODO(nweiz): re-enable this (issue 9022).
172 var errors; 172 // expectTestsPass("nextLine throws an error if there's no more stdout", () {
173 test('test 1', () { 173 // var errors;
174 currentSchedule.onException.schedule(() { 174 // test('test 1', () {
175 errors = currentSchedule.errors; 175 // currentSchedule.onException.schedule(() {
176 }); 176 // errors = currentSchedule.errors;
177 177 // });
178 var process = startDartProcess('print("hello");'); 178 //
179 expect(process.nextLine(), completion(equals('hello'))); 179 // var process = startDartProcess('print("hello");');
180 expect(process.nextLine(), completion(equals('world'))); 180 // expect(process.nextLine(), completion(equals('hello')));
181 process.shouldExit(0); 181 // expect(process.nextLine(), completion(equals('world')));
182 }); 182 // process.shouldExit(0);
183 183 // });
184 test('test 2', () { 184 //
185 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 185 // test('test 2', () {
186 expect(errors.length, equals(2)); 186 // expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
187 expect(errors[0].error, isStateError); 187 // expect(errors.length, equals(2));
188 expect(errors[0].error.message, equals("No elements")); 188 // expect(errors[0].error, isStateError);
189 expect(errors[1].error, matches(r"^Process " 189 // expect(errors[0].error.message, equals("No elements"));
190 r"'[^']+[\\/]dart(\.exe)? [^']+' ended earlier than scheduled with " 190 // expect(errors[1].error, matches(r"^Process "
191 r"exit code 0\.")); 191 // r"'[^']+[\\/]dart(\.exe)? [^']+' ended earlier than scheduled with "
192 }); 192 // r"exit code 0\."));
193 }, passing: ['test 2']); 193 // });
194 // }, passing: ['test 2']);
194 195
195 expectTestsPass("nextErrLine returns the next line of stderr from the " 196 expectTestsPass("nextErrLine returns the next line of stderr from the "
196 "process", () { 197 "process", () {
197 test('test', () { 198 test('test', () {
198 var process = startDartProcess(r''' 199 var process = startDartProcess(r'''
199 stderr.write("hello\n\nworld\n"); 200 stderr.write("hello\n\nworld\n");
200 stderr.write("hi"); 201 stderr.write("hi");
201 '''); 202 ''');
202 expect(process.nextErrLine(), completion(equals('hello'))); 203 expect(process.nextErrLine(), completion(equals('hello')));
203 expect(process.nextErrLine(), completion(equals(''))); 204 expect(process.nextErrLine(), completion(equals('')));
204 expect(process.nextErrLine(), completion(equals('world'))); 205 expect(process.nextErrLine(), completion(equals('world')));
205 expect(process.nextErrLine(), completion(equals('hi'))); 206 expect(process.nextErrLine(), completion(equals('hi')));
206 process.shouldExit(0); 207 process.shouldExit(0);
207 }); 208 });
208 }); 209 });
209 210
210 expectTestsPass("nextErrLine throws an error if there's no more stderr", () { 211 // TODO(nweiz): re-enable this (issue 9022).
211 var errors; 212 // expectTestsPass("nextErrLine throws an error if there's no more stderr", () {
212 test('test 1', () { 213 // var errors;
213 currentSchedule.onException.schedule(() { 214 // test('test 1', () {
214 errors = currentSchedule.errors; 215 // currentSchedule.onException.schedule(() {
215 }); 216 // errors = currentSchedule.errors;
216 217 // });
217 var process = startDartProcess(r'stderr.write("hello\n");'); 218 //
218 expect(process.nextErrLine(), completion(equals('hello'))); 219 // var process = startDartProcess(r'stderr.write("hello\n");');
219 expect(process.nextErrLine(), completion(equals('world'))); 220 // expect(process.nextErrLine(), completion(equals('hello')));
220 process.shouldExit(0); 221 // expect(process.nextErrLine(), completion(equals('world')));
221 }); 222 // process.shouldExit(0);
222 223 // });
223 test('test 2', () { 224 //
224 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 225 // test('test 2', () {
225 expect(errors.length, equals(2)); 226 // expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
226 expect(errors[0].error, isStateError); 227 // expect(errors.length, equals(2));
227 expect(errors[0].error.message, equals("No elements")); 228 // expect(errors[0].error, isStateError);
228 expect(errors[1].error, matches(r"^Process " 229 // expect(errors[0].error.message, equals("No elements"));
229 r"'[^']+[\\/]dart(\.exe)? [^']+' ended earlier than scheduled with " 230 // expect(errors[1].error, matches(r"^Process "
230 r"exit code 0\.")); 231 // r"'[^']+[\\/]dart(\.exe)? [^']+' ended earlier than scheduled with "
231 }); 232 // r"exit code 0\."));
232 }, passing: ['test 2']); 233 // });
234 // }, passing: ['test 2']);
233 235
234 expectTestsPass("remainingStdout returns all the stdout if it's not consumed " 236 expectTestsPass("remainingStdout returns all the stdout if it's not consumed "
235 "any other way", () { 237 "any other way", () {
236 test('test', () { 238 test('test', () {
237 var process = startDartProcess(r'print("hello\n\nworld"); print("hi");'); 239 var process = startDartProcess(r'print("hello\n\nworld"); print("hi");');
238 process.shouldExit(0); 240 process.shouldExit(0);
239 expect(process.remainingStdout(), 241 expect(process.remainingStdout(),
240 completion(equals("hello\n\nworld\nhi"))); 242 completion(equals("hello\n\nworld\nhi")));
241 }); 243 });
242 }); 244 });
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 371
370 currentSchedule.onComplete.schedule(() { 372 currentSchedule.onComplete.schedule(() {
371 return tempDir.catchError((_) => null).then((dir) { 373 return tempDir.catchError((_) => null).then((dir) {
372 if (dir == null) return; 374 if (dir == null) return;
373 return new Directory(dir).delete(recursive: true); 375 return new Directory(dir).delete(recursive: true);
374 }); 376 });
375 }, 'clean up temp dir'); 377 }, 'clean up temp dir');
376 378
377 return new ScheduledProcess.start(dartExecutable, ['--checked', dartPath]); 379 return new ScheduledProcess.start(dartExecutable, ['--checked', dartPath]);
378 } 380 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/scheduled_process.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698