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