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

Unified Diff: pkg/matcher/test/test_utils.dart

Issue 199793010: pkg/matcher: test cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 6 years, 9 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 | « pkg/matcher/test/test_common.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/matcher/test/test_utils.dart
diff --git a/pkg/matcher/test/test_utils.dart b/pkg/matcher/test/test_utils.dart
index fba527afbc451f1a8ba2dd8d232a0a19489eed57..c29bec91c68b4d08737afe41c8c60d4c9b88e214 100644
--- a/pkg/matcher/test/test_utils.dart
+++ b/pkg/matcher/test/test_utils.dart
@@ -2,21 +2,21 @@
// 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 test_utils;
-
-import 'package:matcher/matcher.dart';
-import 'package:unittest/unittest.dart' as ut;
+library matcher.test_utils;
import 'dart:async';
-int errorCount;
-String errorString;
-var _testHandler = null;
+import 'package:matcher/matcher.dart';
+import 'package:unittest/unittest.dart' show test, expectAsync;
+
+int _errorCount;
+String _errorString;
+FailureHandler _testHandler = null;
class MyFailureHandler extends DefaultFailureHandler {
void fail(String reason) {
- ++errorCount;
- errorString = reason;
+ ++_errorCount;
+ _errorString = reason;
}
}
@@ -28,21 +28,21 @@ void initUtils() {
void shouldFail(value, Matcher matcher, expected, {bool isAsync: false}) {
configureExpectFailureHandler(_testHandler);
- errorCount = 0;
- errorString = '';
+ _errorCount = 0;
+ _errorString = '';
expect(value, matcher);
afterTest() {
configureExpectFailureHandler(null);
- expect(errorCount, equals(1));
+ expect(_errorCount, equals(1));
if (expected is String) {
- expect(errorString, equalsIgnoringWhitespace(expected));
+ expect(_errorString, equalsIgnoringWhitespace(expected));
} else {
- expect(errorString.replaceAll('\n', ''), expected);
+ expect(_errorString.replaceAll('\n', ''), expected);
}
}
if (isAsync) {
- Timer.run(ut.expectAsync(afterTest));
+ Timer.run(expectAsync(afterTest));
} else {
afterTest();
}
@@ -50,15 +50,15 @@ void shouldFail(value, Matcher matcher, expected, {bool isAsync: false}) {
void shouldPass(value, Matcher matcher, {bool isAsync: false}) {
configureExpectFailureHandler(_testHandler);
- errorCount = 0;
- errorString = '';
+ _errorCount = 0;
+ _errorString = '';
expect(value, matcher);
afterTest() {
configureExpectFailureHandler(null);
- expect(errorCount, equals(0));
+ expect(_errorCount, equals(0));
}
if (isAsync) {
- Timer.run(ut.expectAsync(afterTest));
+ Timer.run(expectAsync(afterTest));
} else {
afterTest();
}
« no previous file with comments | « pkg/matcher/test/test_common.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698