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

Unified Diff: test/runner_test.dart

Issue 934413002: Replace the existing unittest APIs with the new runner infrastructure. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Code review changes Created 5 years, 10 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/returning_future_using_runasync_test.dart ('k') | test/runtests_without_tests_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner_test.dart
diff --git a/test/runner_test.dart b/test/runner_test.dart
index 2b22667f2bab4fc19fe6f3237480b3fff211892e..5dc5439225f132031125da42ec0d76b0c7a26ed0 100644
--- a/test/runner_test.dart
+++ b/test/runner_test.dart
@@ -15,9 +15,10 @@ String _sandbox;
final _success = """
import 'dart:async';
+import 'package:unittest/unittest.dart';
+
void main() {
- var declarer = Zone.current[#unittest.declarer];
- declarer.test("success", () {});
+ test("success", () {});
}
""";
@@ -27,8 +28,7 @@ import 'dart:async';
import 'package:unittest/unittest.dart';
void main() {
- var declarer = Zone.current[#unittest.declarer];
- declarer.test("failure", () => throw new TestFailure("oh no"));
+ test("failure", () => throw new TestFailure("oh no"));
}
""";
@@ -167,6 +167,15 @@ Usage: pub run unittest:unittest [files or directories...]
var result = _runUnittest([]);
expect(result.exitCode, equals(0));
});
+
+ test("directly", () {
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
+ var result = _runDart([
+ "--package-root=${p.join(packageDir, 'packages')}",
+ "test.dart"
+ ]);
+ expect(result.stdout, contains("All tests passed!"));
+ });
});
group("runs failing tests", () {
@@ -196,8 +205,20 @@ Usage: pub run unittest:unittest [files or directories...]
var result = _runUnittest([]);
expect(result.exitCode, equals(1));
});
+
+ test("directly", () {
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
+ var result = _runDart([
+ "--package-root=${p.join(packageDir, 'packages')}",
+ "test.dart"
+ ]);
+ expect(result.stdout, contains("Some tests failed."));
+ });
});
}
ProcessResult _runUnittest(List<String> args) =>
runUnittest(args, workingDirectory: _sandbox);
+
+ProcessResult _runDart(List<String> args) =>
+ runDart(args, workingDirectory: _sandbox);
« no previous file with comments | « test/returning_future_using_runasync_test.dart ('k') | test/runtests_without_tests_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698