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

Unified Diff: test/runner/expanded_reporter_test.dart

Issue 1243293002: Convert a bunch of tests to use scheduled_test's infrastructure. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 5 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 | « test/runner/compact_reporter_test.dart ('k') | test/runner/pub_serve_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/expanded_reporter_test.dart
diff --git a/test/runner/expanded_reporter_test.dart b/test/runner/expanded_reporter_test.dart
index d22ad8d322474b4c64f3f1264679f7d6b6fa0935..a35f569271f42f99bf05b9846c2f13e58d2ccb4b 100644
--- a/test/runner/expanded_reporter_test.dart
+++ b/test/runner/expanded_reporter_test.dart
@@ -4,22 +4,21 @@
@TestOn("vm")
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:test/src/util/io.dart';
-import 'package:test/test.dart';
+import 'package:scheduled_test/descriptor.dart' as d;
+import 'package:scheduled_test/scheduled_stream.dart';
+import 'package:scheduled_test/scheduled_test.dart';
import '../io.dart';
void main() {
+ useSandbox();
+
test("reports when no tests are run", () {
- return withTempDir((path) {
- new File(p.join(path, "test.dart")).writeAsStringSync("void main() {}");
- var result = runTest(["-r", "expanded", "test.dart"],
- workingDirectory: path);
- expect(result.stdout, contains("No tests ran."));
- });
+ d.file("test.dart", "void main() {}").create();
+
+ var test = runTest(["test.dart"], compact: true);
+ test.stdout.expect(consumeThrough(contains("No tests ran.")));
+ test.shouldExit(0);
});
test("runs several successful tests and reports when each completes", () {
@@ -59,8 +58,7 @@ void main() {
});
test("includes the full stack trace with --verbose-trace", () {
- return withTempDir((path) {
- new File(p.join(path, "test.dart")).writeAsStringSync("""
+ d.file("test.dart", """
import 'dart:async';
import 'package:test/test.dart';
@@ -68,11 +66,11 @@ import 'package:test/test.dart';
void main() {
test("failure", () => throw "oh no");
}
-""");
- var result = runTest(["-r", "compact", "--verbose-trace", "test.dart"],
- workingDirectory: path);
- expect(result.stdout, contains("dart:isolate-patch"));
- });
+""").create();
+
+ var test = runTest(["--verbose-trace", "test.dart"], compact: true);
+ test.stdout.expect(consumeThrough(contains("dart:isolate-patch")));
+ test.shouldExit(1);
});
test("runs failing tests along with successful tests", () {
@@ -309,10 +307,7 @@ void main() {
});
}
-void _expectReport(String tests, String expected, {List<String> args,
- int concurrency}) {
- if (concurrency == null) concurrency = 1;
-
+void _expectReport(String tests, String expected) {
var dart = """
import 'dart:async';
@@ -323,17 +318,16 @@ $tests
}
""";
- expect(withTempDir((path) {
- new File(p.join(path, "test.dart")).writeAsStringSync(dart);
- if (args == null) args = [];
- args = args.toList()
- ..add("test.dart")
- ..add("--concurrency=$concurrency")
- ..add("--reporter=expanded");
- var result = runTest(args, workingDirectory: path);
+ d.file("test.dart", dart).create();
+
+ var test = runTest(["test.dart"]);
+ test.shouldExit();
+
+ schedule(() async {
+ var stdoutLines = await test.stdoutStream().toList();
// Remove excess trailing whitespace and trim off timestamps.
- var actual = result.stdout.trim().split("\n").map((line) {
+ var actual = stdoutLines.map((line) {
if (line.startsWith(" ") || line.isEmpty) return line.trimRight();
return line.trim().replaceFirst(new RegExp("^[0-9]{2}:[0-9]{2} "), "");
}).join("\n");
@@ -346,5 +340,5 @@ $tests
}).join("\n");
expect(actual, equals(expected));
- }), completes);
+ });
}
« no previous file with comments | « test/runner/compact_reporter_test.dart ('k') | test/runner/pub_serve_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698