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

Unified Diff: pkg/scheduled_test/test/descriptor_test.dart

Issue 12440054: Properly collate multiple directory validation errors in scheduled_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/scheduled_test/lib/src/descriptor/directory_descriptor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/test/descriptor_test.dart
diff --git a/pkg/scheduled_test/test/descriptor_test.dart b/pkg/scheduled_test/test/descriptor_test.dart
index fe28b699f70a3c02450826bb0b04e157dce8af0c..7fdbfc2c5003f39083d3e657964391354edefde1 100644
--- a/pkg/scheduled_test/test/descriptor_test.dart
+++ b/pkg/scheduled_test/test/descriptor_test.dart
@@ -295,7 +295,7 @@ void main() {
test('test 2', () {
expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
expect(errors.length, equals(1));
- expect(errors.first.error,
+ expect(errors.first.error.toString(),
matches(r"^Directory not found: '[^']+[\\/]dir[\\/]subdir'\.$"));
});
}, passing: ['test 2']);
@@ -337,11 +337,58 @@ void main() {
test('test 2', () {
expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
expect(errors.length, equals(1));
- expect(errors.first.error,
+ expect(errors.first.error.toString(),
matches(r"^File not found: '[^']+[\\/]dir[\\/]file2\.txt'\.$"));
});
}, passing: ['test 2']);
+ expectTestsPass("directory().validate() fails if multiple children aren't "
+ "found or have the wrong contents", () {
+ var errors;
+ test('test 1', () {
+ scheduleSandbox();
+
+ currentSchedule.onException.schedule(() {
+ errors = currentSchedule.errors;
+ });
+
+ schedule(() {
+ var dirPath = path.join(sandbox, 'dir');
+ var subdirPath = path.join(dirPath, 'subdir');
+ return new Directory(subdirPath).create(recursive: true).then((_) {
+ return Future.wait([
+ new File(path.join(dirPath, 'file1.txt'))
+ .writeAsString('contents1'),
+ new File(path.join(subdirPath, 'subfile2.txt'))
+ .writeAsString('subwrongtents2')
+ ]);
+ });
+ });
+
+ d.dir('dir', [
+ d.dir('subdir', [
+ d.file('subfile1.txt', 'subcontents1'),
+ d.file('subfile2.txt', 'subcontents2')
+ ]),
+ d.file('file1.txt', 'contents1'),
+ d.file('file2.txt', 'contents2')
+ ]).validate();
+ });
+
+ test('test 2', () {
+ expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
+ expect(errors.length, equals(1));
+ expect(errors.first.error.toString(), matches(
+ r"^\* File not found: '[^']+[\\/]dir[\\/]subdir[\\/]subfile1\.txt'\."
+ r"\n"
+ r"\* File 'subfile2\.txt' should contain:\n"
+ r" \| subcontents2\n"
+ r" but actually contained:\n"
+ r" X subwrongtents2\n"
+ r"\* File not found: '[^']+[\\/]dir[\\/]file2\.txt'\.$"));
+ });
+ }, passing: ['test 2']);
+
expectTestsPass("directory().validate() fails if a file has the wrong "
"contents", () {
var errors;
@@ -381,7 +428,7 @@ void main() {
test('test 2', () {
expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.map((e) => e.error), equals([
+ expect(errors.map((e) => e.error.toString()), equals([
"File 'subfile1.txt' should contain:\n"
"| subcontents1\n"
"but actually contained:\n"
« no previous file with comments | « pkg/scheduled_test/lib/src/descriptor/directory_descriptor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698