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

Unified Diff: test/runner/loader_test.dart

Issue 1196413003: Add a LoadSuite class. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 6 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: test/runner/loader_test.dart
diff --git a/test/runner/loader_test.dart b/test/runner/loader_test.dart
index f8618089fb3cd6a26f01b4818edab36fc0e158f5..039055765c250013d7e186f21ccd990fbb461583 100644
--- a/test/runner/loader_test.dart
+++ b/test/runner/loader_test.dart
@@ -53,7 +53,8 @@ void main() {
var suites = await _loader.loadFile(p.join(_sandbox, 'a_test.dart'))
.toList();
expect(suites, hasLength(1));
- suite = suites.first;
+ var loadSuite = suites.first;
+ suite = await loadSuite.getSuite();
});
test("returns a suite with the file path and platform", () {
@@ -124,7 +125,9 @@ void main() {
new File(p.join(_sandbox, 'dir/sub_test.dart'))
.writeAsStringSync(_tests);
- suites = await _loader.loadDir(_sandbox).toList();
+ suites = await _loader.loadDir(_sandbox)
+ .asyncMap((loadSuite) => loadSuite.getSuite())
+ .toList();
});
test("gives those suites the correct paths", () {
@@ -143,4 +146,24 @@ void main() {
});
});
});
+
+ test("a print in a loaded file is piped through the LoadSuite", () async {
+ new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync("""
+void main() {
+ print('print within test');
+}
+""");
+ var suites = await _loader.loadFile(p.join(_sandbox, 'a_test.dart'))
+ .toList();
+ expect(suites, hasLength(1));
+ var loadSuite = suites.first;
+
+ var liveTest = await loadSuite.tests.single.load(loadSuite);
+ expect(liveTest.onPrint.first, completion(equals("print within test")));
+ await liveTest.run();
+ expectTestPassed(liveTest);
+ });
+
+ // TODO: Test load suites. Don't forget to test that prints in loaded files
+ // are piped through the suite. Also for browser tests!
}

Powered by Google App Engine
This is Rietveld 408576698