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

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

Issue 12328143: pkg/unittest: Moved `fail` to matcher library (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixes to align with r19166 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/unittest/lib/unittest.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // TODO(gram): 5 // TODO(gram):
6 // Unfortunately I can't seem to test anything that involves timeouts, e.g. 6 // Unfortunately I can't seem to test anything that involves timeouts, e.g.
7 // insufficient callbacks, because the timeout is controlled externally 7 // insufficient callbacks, because the timeout is controlled externally
8 // (test.dart?), and we would need to use a shorter timeout for the inner tests 8 // (test.dart?), and we would need to use a shorter timeout for the inner tests
9 // so the outer timeout doesn't fire. So I removed all such tests. 9 // so the outer timeout doesn't fire. So I removed all such tests.
10 // I'd like to revisit this at some point. 10 // I'd like to revisit this at some point.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 }); 125 });
126 } else if (testName == 'async exception test') { 126 } else if (testName == 'async exception test') {
127 test(testName, () { 127 test(testName, () {
128 expectAsync0(() {}); 128 expectAsync0(() {});
129 _defer(() => guardAsync(() { throw "error!"; })); 129 _defer(() => guardAsync(() { throw "error!"; }));
130 }); 130 });
131 } else if (testName == 'late exception test') { 131 } else if (testName == 'late exception test') {
132 test('testOne', () { 132 test('testOne', () {
133 var f = expectAsync0(() {}); 133 var f = expectAsync0(() {});
134 _defer(protectAsync0(() { 134 _defer(protectAsync0(() {
135 _defer(protectAsync0(() => expect(false, isTrue))); 135 _defer(protectAsync0(() => fail('first failure')));
136 expect(false, isTrue); 136 fail('second failure');
137 })); 137 }));
138 }); 138 });
139 test('testTwo', () { 139 test('testTwo', () {
140 _defer(expectAsync0(() {})); 140 _defer(expectAsync0(() {}));
141 }); 141 });
142 } else if (testName == 'middle exception test') { 142 } else if (testName == 'middle exception test') {
143 test('testOne', () { expect(true, isTrue); }); 143 test('testOne', () { expect(true, isTrue); });
144 test('testTwo', () { expect(true, isFalse); }); 144 test('testTwo', () { expect(true, isFalse); });
145 test('testThree', () { 145 test('testThree', () {
146 var done = expectAsync0((){}); 146 var done = expectAsync0((){});
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 var callback = expectAsync0((){}); 255 var callback = expectAsync0((){});
256 var excesscallback = expectAsync0((){}); 256 var excesscallback = expectAsync0((){});
257 return _defer(() { 257 return _defer(() {
258 excesscallback(); 258 excesscallback();
259 excesscallback(); 259 excesscallback();
260 callback(); 260 callback();
261 }); 261 });
262 }); 262 });
263 test("fail2", () { 263 test("fail2", () {
264 return _defer(() { 264 return _defer(() {
265 expect(false, true); 265 fail('failure');
266 }); 266 });
267 }); 267 });
268 test('foo5', () { 268 test('foo5', () {
269 }); 269 });
270 } else if (testName == 'test returning future using Timer') { 270 } else if (testName == 'test returning future using Timer') {
271 test("successful", () { 271 test("successful", () {
272 return _defer(() { 272 return _defer(() {
273 Timer.run(() { 273 Timer.run(() {
274 guardAsync(() { 274 guardAsync(() {
275 expect(true, true); 275 expect(true, true);
(...skipping 24 matching lines...) Expand all
300 callback(); 300 callback();
301 }); 301 });
302 }); 302 });
303 }); 303 });
304 }); 304 });
305 test("fail2", () { 305 test("fail2", () {
306 var callback = expectAsync0((){}); 306 var callback = expectAsync0((){});
307 return _defer(() { 307 return _defer(() {
308 Timer.run(() { 308 Timer.run(() {
309 guardAsync(() { 309 guardAsync(() {
310 expect(false, true); 310 fail('failure');
311 callback(); 311 callback();
312 }); 312 });
313 }); 313 });
314 }); 314 });
315 }); 315 });
316 test('error2', () { 316 test('error2', () {
317 var callback = expectAsync0((){}); 317 var callback = expectAsync0((){});
318 var excesscallback = expectAsync0((){}); 318 var excesscallback = expectAsync0((){});
319 return _defer(() { 319 return _defer(() {
320 Timer.run(() { 320 Timer.run(() {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 'bad setup/good teardown foo3:bad setup/good teardown ' 394 'bad setup/good teardown foo3:bad setup/good teardown '
395 'foo3: Test setup failed: Failed to complete setUp:' 395 'foo3: Test setup failed: Failed to complete setUp:'
396 'bad setup/bad teardown foo4:bad setup/bad teardown ' 396 'bad setup/bad teardown foo4:bad setup/bad teardown '
397 'foo4: Test teardown failed: Failed to complete tearDown:' 397 'foo4: Test teardown failed: Failed to complete tearDown:'
398 'post groups'), 398 'post groups'),
399 buildStatusString(2, 2, 2, 399 buildStatusString(2, 2, 2,
400 'successful::' 400 'successful::'
401 'error1:Callback called more times than expected (3 > 1).:' 401 'error1:Callback called more times than expected (3 > 1).:'
402 'fail1:Expected: <false> but: was <true>.:' 402 'fail1:Expected: <false> but: was <true>.:'
403 'error2:Callback called more times than expected (2 > 1).:' 403 'error2:Callback called more times than expected (2 > 1).:'
404 'fail2:Expected: <true> but: was <false>.:' 404 'fail2:failure:'
405 'foo5'), 405 'foo5'),
406 buildStatusString(2, 2, 2, 406 buildStatusString(2, 2, 2,
407 'successful::' 407 'successful::'
408 'fail1:Expected: <false> but: was <true>.:' 408 'fail1:Expected: <false> but: was <true>.:'
409 'error1:Callback called more times than expected (3 > 1).:' 409 'error1:Callback called more times than expected (3 > 1).:'
410 'fail2:Expected: <true> but: was <false>.:' 410 'fail2:failure:'
411 'error2:Callback called more times than expected (2 > 1).:' 411 'error2:Callback called more times than expected (2 > 1).:'
412 'foo6'), 412 'foo6'),
413 ]; 413 ];
414 414
415 actual = []; 415 actual = [];
416 416
417 nextTest(0); 417 nextTest(0);
418 } 418 }
419 419
OLDNEW
« no previous file with comments | « pkg/unittest/lib/unittest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698