OLD | NEW |
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 Loading... |
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.toString(), |
60 matches(r"^Expected nothing to exist at '[^']+[\\/]name.txt', but " | 60 matches(r"^Expected nothing to exist at '[^']+[\\/]name.txt', but " |
61 r"found a file\.$")); | 61 r"found a file\.$")); |
62 }); | 62 }); |
63 }, passing: ['test 2']); | 63 }, passing: ['test 2']); |
64 | 64 |
65 expectTestsPass("nothing().validate() fails if there's a directory", () { | 65 expectTestsPass("nothing().validate() fails if there's a directory", () { |
66 var errors; | 66 var errors; |
67 test('test 1', () { | 67 test('test 1', () { |
68 scheduleSandbox(); | 68 scheduleSandbox(); |
69 | 69 |
70 currentSchedule.onException.schedule(() { | 70 currentSchedule.onException.schedule(() { |
71 errors = currentSchedule.errors; | 71 errors = currentSchedule.errors; |
72 }); | 72 }); |
73 | 73 |
74 d.dir('dir').create(); | 74 d.dir('dir').create(); |
75 d.nothing('dir').validate(); | 75 d.nothing('dir').validate(); |
76 }); | 76 }); |
77 | 77 |
78 test('test 2', () { | 78 test('test 2', () { |
79 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); | 79 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); |
80 expect(errors.length, equals(1)); | 80 expect(errors.length, equals(1)); |
81 expect(errors.first.error, | 81 expect(errors.first.error.toString(), |
82 matches(r"^Expected nothing to exist at '[^']+[\\/]dir', but found a " | 82 matches(r"^Expected nothing to exist at '[^']+[\\/]dir', but found a " |
83 r"directory\.$")); | 83 r"directory\.$")); |
84 }); | 84 }); |
85 }, passing: ['test 2']); | 85 }, passing: ['test 2']); |
86 } | 86 } |
OLD | NEW |