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

Unified Diff: pkg/scheduled_test/test/descriptor/directory_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: Also in async_test.dart 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 side-by-side diff with in-line comments
Download patch
Index: pkg/scheduled_test/test/descriptor/directory_test.dart
diff --git a/pkg/scheduled_test/test/descriptor/directory_test.dart b/pkg/scheduled_test/test/descriptor/directory_test.dart
index a8051cc58dabadc8ae62557a16068e399c55a9cf..82c6d8da03c1e44bbe93f52cb79fde4fbbed162c 100644
--- a/pkg/scheduled_test/test/descriptor/directory_test.dart
+++ b/pkg/scheduled_test/test/descriptor/directory_test.dart
@@ -125,9 +125,8 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(1));
- expect(errors.first.error.toString(),
+ expect(errors.single, new isInstanceOf<ScheduleError>());
+ expect(errors.single.error.toString(),
matches(r"^Directory not found: '[^']+[\\/]dir[\\/]subdir'\.$"));
});
}, passing: ['test 2']);
@@ -167,9 +166,8 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(1));
- expect(errors.first.error.toString(),
+ expect(errors.single, new isInstanceOf<ScheduleError>());
+ expect(errors.single.error.toString(),
matches(r"^File not found: '[^']+[\\/]dir[\\/]file2\.txt'\.$"));
});
}, passing: ['test 2']);
@@ -208,9 +206,8 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.length, equals(1));
- expect(errors.first.error.toString(), matches(
+ expect(errors.single, new isInstanceOf<ScheduleError>());
+ expect(errors.single.error.toString(), matches(
r"^\* File not found: '[^']+[\\/]dir[\\/]subdir[\\/]subfile1\.txt'\."
r"\n"
r"\* File 'subfile2\.txt' should contain:\n"
@@ -259,13 +256,12 @@ void main() {
});
test('test 2', () {
- expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
- expect(errors.map((e) => e.error.toString()), equals([
- "File 'subfile1.txt' should contain:\n"
- "| subcontents1\n"
- "but actually contained:\n"
- "X wrongtents1"
- ]));
+ expect(errors.single, new isInstanceOf<ScheduleError>());
+ expect(errors.single.error.toString(), equals(
+ "File 'subfile1.txt' should contain:\n"
+ "| subcontents1\n"
+ "but actually contained:\n"
+ "X wrongtents1"));
});
}, passing: ['test 2']);
@@ -300,9 +296,9 @@ void main() {
d.file('name.txt', 'contents')
]);
- expect(dir.load('subdir').toList(),
- throwsA(equals("Couldn't find a readable entry named 'subdir' within "
- "'dir'.")));
+ expect(dir.load('subdir').toList(), throwsA(predicate(
+ (x) => x.toString() == "Couldn't find a readable entry named "
+ "'subdir' within 'dir'.")));
});
});
@@ -331,9 +327,9 @@ void main() {
test('test', () {
var dir = d.dir('dir', [d.file('name.txt', 'contents')]);
- expect(dir.load('not-name.txt').toList(),
- throwsA(equals("Couldn't find a readable entry named 'not-name.txt' "
- "within 'dir'.")));
+ expect(dir.load('not-name.txt').toList(), throwsA(predicate(
+ (x) => x.toString() == "Couldn't find a readable entry named "
+ "'not-name.txt' within 'dir'.")));
});
});
@@ -345,9 +341,9 @@ void main() {
d.file('name.txt', 'contents')
]);
- expect(dir.load('name.txt').toList(),
- throwsA(equals("Found multiple readable entries named 'name.txt' "
- "within 'dir'.")));
+ expect(dir.load('name.txt').toList(), throwsA(predicate(
+ (x) => x.toString() == "Found multiple readable entries named "
+ "'name.txt' within 'dir'.")));
});
});
@@ -412,4 +408,4 @@ void main() {
expect(d.dir('dir').describe(), equals('dir'));
});
});
-}
+}
« no previous file with comments | « pkg/scheduled_test/test/descriptor/async_test.dart ('k') | pkg/scheduled_test/test/descriptor/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698