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

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

Issue 24276010: Change package scheduled_test to throw TestFailures rather than strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:path/path.dart' as path; 7 import 'package:path/path.dart' as path;
8 import 'package:scheduled_test/descriptor.dart' as d; 8 import 'package:scheduled_test/descriptor.dart' as d;
9 import 'package:scheduled_test/scheduled_test.dart'; 9 import 'package:scheduled_test/scheduled_test.dart';
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 errors = currentSchedule.errors; 49 errors = currentSchedule.errors;
50 }); 50 });
51 51
52 d.file('name.txt', 'contents').create(); 52 d.file('name.txt', 'contents').create();
53 d.nothing('name.txt').validate(); 53 d.nothing('name.txt').validate();
54 }); 54 });
55 55
56 test('test 2', () { 56 test('test 2', () {
57 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 57 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
58 expect(errors.length, equals(1)); 58 expect(errors.length, equals(1));
59 expect(errors.first.error, 59 expect(errors.first.error, new isInstanceOf<TestFailure>());
60 expect(errors.first.error.message,
60 matches(r"^Expected nothing to exist at '[^']+[\\/]name.txt', but " 61 matches(r"^Expected nothing to exist at '[^']+[\\/]name.txt', but "
61 r"found a file\.$")); 62 r"found a file\.$"));
62 }); 63 });
63 }, passing: ['test 2']); 64 }, passing: ['test 2']);
64 65
65 expectTestsPass("nothing().validate() fails if there's a directory", () { 66 expectTestsPass("nothing().validate() fails if there's a directory", () {
66 var errors; 67 var errors;
67 test('test 1', () { 68 test('test 1', () {
68 scheduleSandbox(); 69 scheduleSandbox();
69 70
70 currentSchedule.onException.schedule(() { 71 currentSchedule.onException.schedule(() {
71 errors = currentSchedule.errors; 72 errors = currentSchedule.errors;
72 }); 73 });
73 74
74 d.dir('dir').create(); 75 d.dir('dir').create();
75 d.nothing('dir').validate(); 76 d.nothing('dir').validate();
76 }); 77 });
77 78
78 test('test 2', () { 79 test('test 2', () {
79 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 80 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
80 expect(errors.length, equals(1)); 81 expect(errors.length, equals(1));
81 expect(errors.first.error, 82 expect(errors.first.error, new isInstanceOf<TestFailure>());
83 expect(errors.first.error.message,
82 matches(r"^Expected nothing to exist at '[^']+[\\/]dir', but found a " 84 matches(r"^Expected nothing to exist at '[^']+[\\/]dir', but found a "
83 r"directory\.$")); 85 r"directory\.$"));
84 }); 86 });
85 }, passing: ['test 2']); 87 }, passing: ['test 2']);
86 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698