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

Unified Diff: pkg/unittest/test/async_setup_teardown_test.dart

Issue 524153002: Sharing metatest logic between unittest and scheduled_test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: CR feedback Created 6 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/unittest/test/async_setup_teardown_test.dart
diff --git a/pkg/unittest/test/async_setup_teardown_test.dart b/pkg/unittest/test/async_setup_teardown_test.dart
index 56e7c1264b4d6ab55139be5557a133e888ace8b6..8cc4c7bf8bd64dc6ae33271274d56102f203fb32 100644
--- a/pkg/unittest/test/async_setup_teardown_test.dart
+++ b/pkg/unittest/test/async_setup_teardown_test.dart
@@ -2,19 +2,20 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library unittestTest;
+library unittest.async_setup_teardown;
import 'dart:async';
-import 'dart:isolate';
import 'package:unittest/unittest.dart';
-part 'utils.dart';
+import 'package:metatest/metatest.dart';
-var testName = 'async setup teardown test';
+void main() => initTests(_test);
-var testFunction = (_) {
- group('good setup/good teardown', () {
+void _test(message) {
+ initMetatest(message);
+
+ expectSingleTest('good setup/good teardown', 'pass', '', () {
nweiz 2014/09/10 21:04:43 This interface is really hard to read. Why is the
kevmoo 2014/09/17 21:16:29 I eliminated expectSingleTest. Fewer methods == be
setUp(() {
return new Future.value(0);
});
@@ -23,7 +24,12 @@ var testFunction = (_) {
});
test('foo1', () {});
});
- group('good setup/bad teardown', () {
+
+ expectSingleTest(
+ 'good setup/bad teardown',
+ 'error',
+ 'Teardown failed: Caught Failed to complete tearDown',
+ () {
setUp(() {
return new Future.value(0);
});
@@ -32,7 +38,12 @@ var testFunction = (_) {
});
test('foo2', () {});
});
- group('bad setup/good teardown', () {
+
+ expectSingleTest(
+ 'bad setup/good teardown',
+ 'error',
+ 'Setup failed: Caught Failed to complete setUp',
+ () {
setUp(() {
return new Future.error("Failed to complete setUp");
});
@@ -41,7 +52,12 @@ var testFunction = (_) {
});
test('foo3', () {});
});
- group('bad setup/bad teardown', () {
+
+ expectSingleTest(
+ 'bad setup/bad teardown',
+ 'error',
+ 'Setup failed: Caught Failed to complete setUp',
+ () {
setUp(() {
return new Future.error("Failed to complete setUp");
});
@@ -50,17 +66,4 @@ var testFunction = (_) {
});
test('foo4', () {});
});
- // The next test is just to make sure we make steady progress
- // through the tests.
- test('post groups', () {});
-};
-
-final expected = buildStatusString(2, 0, 3,
- 'good setup/good teardown foo1::'
- 'good setup/bad teardown foo2:'
- 'Teardown failed: Caught Failed to complete tearDown:'
- 'bad setup/good teardown foo3:'
- 'Setup failed: Caught Failed to complete setUp:'
- 'bad setup/bad teardown foo4:'
- 'Setup failed: Caught Failed to complete setUp:'
- 'post groups');
+}

Powered by Google App Engine
This is Rietveld 408576698