pkg/matcher: test cleanup

R=blois@google.com

Review URL: https://codereview.chromium.org//199793010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/matcher@34342 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/test/matchers_minified_test.dart b/test/matchers_minified_test.dart
index e071c09..65a35ac 100644
--- a/test/matchers_minified_test.dart
+++ b/test/matchers_minified_test.dart
@@ -6,20 +6,22 @@
 // These tests normally fail when run in minified dart2js, since the names will
 // be mangled. This version of the file is modified to expect minified names.
 
+library matcher.minified_test;
+
 import 'package:matcher/matcher.dart';
-import 'package:unittest/unittest.dart' as ut;
+import 'package:unittest/unittest.dart' show test, group;
 
 import 'test_common.dart';
 import 'test_utils.dart';
 
 // A regexp fragment matching a minified name.
-final _minifiedName = r"[A-Za-z0-9]{1,3}";
+const _MINIFIED_NAME = r"[A-Za-z0-9]{1,3}";
 
 void main() {
   initUtils();
 
-  ut.group('Core matchers', () {
-    ut.test('throwsFormatException', () {
+  group('Core matchers', () {
+    test('throwsFormatException', () {
       shouldPass(() { throw new FormatException(''); },
           throwsFormatException);
       shouldFail(() { throw new Exception(); },
@@ -27,10 +29,10 @@
           matches(
               r"Expected: throws FormatException +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
 
-    ut.test('throwsArgumentError', () {
+    test('throwsArgumentError', () {
       shouldPass(() { throw new ArgumentError(''); },
           throwsArgumentError);
       shouldFail(() { throw new Exception(); },
@@ -38,10 +40,10 @@
           matches(
               r"Expected: throws ArgumentError +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
 
-    ut.test('throwsRangeError', () {
+    test('throwsRangeError', () {
       shouldPass(() { throw new RangeError(0); },
           throwsRangeError);
       shouldFail(() { throw new Exception(); },
@@ -49,10 +51,10 @@
           matches(
               r"Expected: throws RangeError +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
 
-    ut.test('throwsNoSuchMethodError', () {
+    test('throwsNoSuchMethodError', () {
       shouldPass(() {
         throw new NoSuchMethodError(null, const Symbol(''), null, null);
       }, throwsNoSuchMethodError);
@@ -61,10 +63,10 @@
           matches(
               r"Expected: throws NoSuchMethodError +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
 
-    ut.test('throwsUnimplementedError', () {
+    test('throwsUnimplementedError', () {
       shouldPass(() { throw new UnimplementedError(''); },
           throwsUnimplementedError);
       shouldFail(() { throw new Exception(); },
@@ -72,10 +74,10 @@
           matches(
               r"Expected: throws UnimplementedError +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
 
-    ut.test('throwsUnsupportedError', () {
+    test('throwsUnsupportedError', () {
       shouldPass(() { throw new UnsupportedError(''); },
           throwsUnsupportedError);
       shouldFail(() { throw new Exception(); },
@@ -83,10 +85,10 @@
           matches(
               r"Expected: throws UnsupportedError +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
 
-    ut.test('throwsStateError', () {
+    test('throwsStateError', () {
       shouldPass(() { throw new StateError(''); },
           throwsStateError);
       shouldFail(() { throw new Exception(); },
@@ -94,31 +96,31 @@
           matches(
               r"Expected: throws StateError +"
               r"Actual: <Closure(: \(\) => dynamic)?> +"
-              r"Which: threw " + _minifiedName + r":<Exception>"));
+              r"Which: threw " + _MINIFIED_NAME + r":<Exception>"));
     });
   });
 
-  ut.group('Iterable Matchers', () {
-    ut.test('isEmpty', () {
+  group('Iterable Matchers', () {
+    test('isEmpty', () {
       var d = new SimpleIterable(0);
       var e = new SimpleIterable(1);
       shouldPass(d, isEmpty);
       shouldFail(e, isEmpty,
-          matches(r"Expected: empty +Actual: " + _minifiedName + r":\[1\]"));
+          matches(r"Expected: empty +Actual: " + _MINIFIED_NAME + r":\[1\]"));
     });
 
-    ut.test('contains', () {
+    test('contains', () {
       var d = new SimpleIterable(3);
       shouldPass(d, contains(2));
       shouldFail(d, contains(5),
           matches(
               r"Expected: contains <5> +"
-              r"Actual: " + _minifiedName + r":\[3, 2, 1\]"));
+              r"Actual: " + _MINIFIED_NAME + r":\[3, 2, 1\]"));
     });
   });
 
-  ut.group('Feature Matchers', () {
-    ut.test("Feature Matcher", () {
+  group('Feature Matchers', () {
+    test("Feature Matcher", () {
       var w = new Widget();
       w.price = 10;
       shouldPass(w, new HasPrice(10));
@@ -127,7 +129,7 @@
           matches(
               r"Expected: Widget with a price that is a value greater than "
                   r"<10> +"
-              r"Actual: <Instance of '" + _minifiedName + r"'> +"
+              r"Actual: <Instance of '" + _MINIFIED_NAME + r"'> +"
               r"Which: has price with value <10> which is not "
               r"a value greater than <10>"));
     });
diff --git a/test/matchers_test.dart b/test/matchers_test.dart
index 3d75bd9..e74d048 100644
--- a/test/matchers_test.dart
+++ b/test/matchers_test.dart
@@ -2,11 +2,13 @@
 // 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 matcher.test;
+
 import 'dart:async';
 import 'dart:collection';
 
 import 'package:matcher/matcher.dart';
-import 'package:unittest/unittest.dart' as ut;
+import 'package:unittest/unittest.dart' show test, group;
 
 import 'test_utils.dart';
 
@@ -16,44 +18,44 @@
 
   // Core matchers
 
-  ut.group('Core matchers', () {
+  group('Core matchers', () {
 
-    ut.test('isTrue', () {
+    test('isTrue', () {
       shouldPass(true, isTrue);
       shouldFail(false, isTrue, "Expected: true Actual: <false>");
     });
 
-    ut.test('isFalse', () {
+    test('isFalse', () {
       shouldPass(false, isFalse);
       shouldFail(10, isFalse, "Expected: false Actual: <10>");
       shouldFail(true, isFalse, "Expected: false Actual: <true>");
     });
 
-    ut.test('isNull', () {
+    test('isNull', () {
       shouldPass(null, isNull);
       shouldFail(false, isNull, "Expected: null Actual: <false>");
     });
 
-    ut.test('isNotNull', () {
+    test('isNotNull', () {
       shouldPass(false, isNotNull);
       shouldFail(null, isNotNull, "Expected: not null Actual: <null>");
     });
 
-    ut.test('same', () {
+    test('same', () {
       var a = new Map();
       var b = new Map();
       shouldPass(a, same(a));
       shouldFail(b, same(a), "Expected: same instance as {} Actual: {}");
     });
 
-    ut.test('equals', () {
+    test('equals', () {
       var a = new Map();
       var b = new Map();
       shouldPass(a, equals(a));
       shouldPass(a, equals(b));
     });
 
-    ut.test('anything', () {
+    test('anything', () {
       var a = new Map();
       shouldPass(0, anything);
       shouldPass(null, anything);
@@ -61,7 +63,7 @@
       shouldFail(a, isNot(anything), "Expected: not anything Actual: {}");
     });
 
-    ut.test('throws', () {
+    test('throws', () {
       shouldFail(doesNotThrow, throws,
           matches(
               r"Expected: throws"
@@ -75,7 +77,7 @@
           "   Which: is not a Function or Future");
     });
 
-    ut.test('throwsA', () {
+    test('throwsA', () {
       shouldPass(doesThrow, throwsA(equals('X')));
       shouldFail(doesThrow, throwsA(equals('Y')),
           matches(
@@ -85,7 +87,7 @@
               r"   Which: threw 'X'"));
     });
 
-    ut.test('returnsNormally', () {
+    test('returnsNormally', () {
       shouldPass(doesNotThrow, returnsNormally);
       shouldFail(doesThrow, returnsNormally,
           matches(
@@ -96,7 +98,7 @@
     });
 
 
-    ut.test('hasLength', () {
+    test('hasLength', () {
       var a = new Map();
       var b = new List();
       shouldPass(a, hasLength(0));
@@ -122,27 +124,27 @@
       shouldPass(b, hasLength(2));
     });
 
-    ut.test('scalar type mismatch', () {
+    test('scalar type mismatch', () {
       shouldFail('error', equals(5.1),
           "Expected: <5.1> "
           "Actual: 'error'");
     });
 
-    ut.test('nested type mismatch', () {
+    test('nested type mismatch', () {
       shouldFail(['error'], equals([5.1]),
           "Expected: [5.1] "
           "Actual: ['error'] "
           "Which: was 'error' instead of <5.1> at location [0]");
     });
 
-    ut.test('doubly-nested type mismatch', () {
+    test('doubly-nested type mismatch', () {
       shouldFail([['error']], equals([[5.1]]),
           "Expected: [[5.1]] "
           "Actual: [['error']] "
           "Which: was 'error' instead of <5.1> at location [0][0]");
     });
 
-    ut.test('doubly nested inequality', () {
+    test('doubly nested inequality', () {
       var actual1 = [['foo', 'bar'], ['foo'], 3, []];
       var expected1 = [['foo', 'bar'], ['foo'], 4, []];
       var reason1 = "Expected: [['foo', 'bar'], ['foo'], 4, []] "
@@ -167,9 +169,9 @@
     });
   });
 
-  ut.group('Numeric Matchers', () {
+  group('Numeric Matchers', () {
 
-    ut.test('greaterThan', () {
+    test('greaterThan', () {
       shouldPass(10, greaterThan(9));
       shouldFail(9, greaterThan(10),
         "Expected: a value greater than <10> "
@@ -177,7 +179,7 @@
         "Which: is not a value greater than <10>");
     });
 
-    ut.test('greaterThanOrEqualTo', () {
+    test('greaterThanOrEqualTo', () {
       shouldPass(10, greaterThanOrEqualTo(10));
       shouldFail(9, greaterThanOrEqualTo(10),
         "Expected: a value greater than or equal to <10> "
@@ -185,7 +187,7 @@
         "Which: is not a value greater than or equal to <10>");
     });
 
-    ut.test('lessThan', () {
+    test('lessThan', () {
       shouldFail(10, lessThan(9),
           "Expected: a value less than <9> "
           "Actual: <10> "
@@ -193,7 +195,7 @@
       shouldPass(9, lessThan(10));
     });
 
-    ut.test('lessThanOrEqualTo', () {
+    test('lessThanOrEqualTo', () {
       shouldPass(10, lessThanOrEqualTo(10));
       shouldFail(11, lessThanOrEqualTo(10),
         "Expected: a value less than or equal to <10> "
@@ -201,7 +203,7 @@
         "Which: is not a value less than or equal to <10>");
     });
 
-    ut.test('isZero', () {
+    test('isZero', () {
       shouldPass(0, isZero);
       shouldFail(1, isZero,
           "Expected: a value equal to <0> "
@@ -209,7 +211,7 @@
           "Which: is not a value equal to <0>");
     });
 
-    ut.test('isNonZero', () {
+    test('isNonZero', () {
       shouldFail(0, isNonZero,
           "Expected: a value not equal to <0> "
           "Actual: <0> "
@@ -217,7 +219,7 @@
       shouldPass(1, isNonZero);
     });
 
-    ut.test('isPositive', () {
+    test('isPositive', () {
       shouldFail(-1, isPositive,
           "Expected: a positive value "
           "Actual: <-1> "
@@ -229,7 +231,7 @@
       shouldPass(1, isPositive);
     });
 
-    ut.test('isNegative', () {
+    test('isNegative', () {
       shouldPass(-1, isNegative);
       shouldFail(0, isNegative,
           "Expected: a negative value "
@@ -237,7 +239,7 @@
           "Which: is not a negative value");
     });
 
-    ut.test('isNonPositive', () {
+    test('isNonPositive', () {
       shouldPass(-1, isNonPositive);
       shouldPass(0, isNonPositive);
       shouldFail(1, isNonPositive,
@@ -246,7 +248,7 @@
           "Which: is not a non-positive value");
     });
 
-    ut.test('isNonNegative', () {
+    test('isNonNegative', () {
       shouldPass(1, isNonNegative);
       shouldPass(0, isNonNegative);
       shouldFail(-1, isNonNegative,
@@ -255,7 +257,7 @@
         "Which: is not a non-negative value");
     });
 
-    ut.test('closeTo', () {
+    test('closeTo', () {
       shouldPass(0, closeTo(0, 1));
       shouldPass(-1, closeTo(0, 1));
       shouldPass(1, closeTo(0, 1));
@@ -269,7 +271,7 @@
           "Which: differs by <1.001>");
     });
 
-    ut.test('inInclusiveRange', () {
+    test('inInclusiveRange', () {
       shouldFail(-1, inInclusiveRange(0,2),
           "Expected: be in range from 0 (inclusive) to 2 (inclusive) "
           "Actual: <-1>");
@@ -281,7 +283,7 @@
           "Actual: <3>");
     });
 
-    ut.test('inExclusiveRange', () {
+    test('inExclusiveRange', () {
       shouldFail(0, inExclusiveRange(0,2),
           "Expected: be in range from 0 (exclusive) to 2 (exclusive) "
           "Actual: <0>");
@@ -291,7 +293,7 @@
           "Actual: <2>");
     });
 
-    ut.test('inOpenClosedRange', () {
+    test('inOpenClosedRange', () {
       shouldFail(0, inOpenClosedRange(0,2),
           "Expected: be in range from 0 (exclusive) to 2 (inclusive) "
           "Actual: <0>");
@@ -299,7 +301,7 @@
       shouldPass(2, inOpenClosedRange(0,2));
     });
 
-    ut.test('inClosedOpenRange', () {
+    test('inClosedOpenRange', () {
       shouldPass(0, inClosedOpenRange(0,2));
       shouldPass(1, inClosedOpenRange(0,2));
       shouldFail(2, inClosedOpenRange(0,2),
@@ -308,9 +310,9 @@
     });
   });
 
-  ut.group('String Matchers', () {
+  group('String Matchers', () {
 
-    ut.test('isEmpty', () {
+    test('isEmpty', () {
       shouldPass('', isEmpty);
       shouldFail(null, isEmpty,
           "Expected: empty Actual: <null>");
@@ -319,13 +321,13 @@
       shouldFail('a', isEmpty, "Expected: empty Actual: 'a'");
     });
 
-    ut.test('equalsIgnoringCase', () {
+    test('equalsIgnoringCase', () {
       shouldPass('hello', equalsIgnoringCase('HELLO'));
       shouldFail('hi', equalsIgnoringCase('HELLO'),
           "Expected: 'HELLO' ignoring case Actual: 'hi'");
     });
 
-    ut.test('equalsIgnoringWhitespace', () {
+    test('equalsIgnoringWhitespace', () {
       shouldPass(' hello   world  ', equalsIgnoringWhitespace('hello world'));
       shouldFail(' helloworld  ', equalsIgnoringWhitespace('hello world'),
           "Expected: 'hello world' ignoring whitespace "
@@ -333,7 +335,7 @@
           "Which: is 'helloworld' with whitespace compressed");
     });
 
-    ut.test('startsWith', () {
+    test('startsWith', () {
       shouldPass('hello', startsWith(''));
       shouldPass('hello', startsWith('hell'));
       shouldPass('hello', startsWith('hello'));
@@ -342,7 +344,7 @@
           "Actual: 'hello'");
     });
 
-    ut.test('endsWith', () {
+    test('endsWith', () {
       shouldPass('hello', endsWith(''));
       shouldPass('hello', endsWith('lo'));
       shouldPass('hello', endsWith('hello'));
@@ -351,7 +353,7 @@
           "Actual: 'hello'");
     });
 
-    ut.test('contains', () {
+    test('contains', () {
       shouldPass('hello', contains(''));
       shouldPass('hello', contains('h'));
       shouldPass('hello', contains('o'));
@@ -361,7 +363,7 @@
           "Expected: contains ' ' Actual: 'hello'");
     });
 
-    ut.test('stringContainsInOrder', () {
+    test('stringContainsInOrder', () {
       shouldPass('goodbye cruel world', stringContainsInOrder(['']));
       shouldPass('goodbye cruel world', stringContainsInOrder(['goodbye']));
       shouldPass('goodbye cruel world', stringContainsInOrder(['cruel']));
@@ -380,7 +382,7 @@
         "Actual: 'goodbye cruel world'");
     });
 
-    ut.test('matches', () {
+    test('matches', () {
       shouldPass('c0d', matches('[a-z][0-9][a-z]'));
       shouldPass('c0d', matches(new RegExp('[a-z][0-9][a-z]')));
       shouldFail('cOd', matches('[a-z][0-9][a-z]'),
@@ -388,21 +390,21 @@
     });
   });
 
-  ut.group('Iterable Matchers', () {
+  group('Iterable Matchers', () {
 
-    ut.test('isEmpty', () {
+    test('isEmpty', () {
       shouldPass([], isEmpty);
       shouldFail([1], isEmpty, "Expected: empty Actual: [1]");
     });
 
-    ut.test('contains', () {
+    test('contains', () {
       var d = [1, 2];
       shouldPass(d, contains(1));
       shouldFail(d, contains(0), "Expected: contains <0> "
           "Actual: [1, 2]");
     });
 
-    ut.test('equals with matcher element', () {
+    test('equals with matcher element', () {
       var d = ['foo', 'bar'];
       shouldPass(d, equals(['foo', startsWith('ba')]));
       shouldFail(d, equals(['foo', endsWith('ba')]),
@@ -411,13 +413,13 @@
           "Which: does not match a string ending with 'ba' at location [1]");
     });
 
-    ut.test('isIn', () {
+    test('isIn', () {
       var d = [1, 2];
       shouldPass(1, isIn(d));
       shouldFail(0, isIn(d), "Expected: is in [1, 2] Actual: <0>");
     });
 
-    ut.test('everyElement', () {
+    test('everyElement', () {
       var d = [1, 2];
       var e = [1, 1, 1];
       shouldFail(d, everyElement(1),
@@ -427,7 +429,7 @@
       shouldPass(e, everyElement(1));
     });
 
-    ut.test('nested everyElement', () {
+    test('nested everyElement', () {
       var d = [['foo', 'bar'], ['foo'], []];
       var e = [['foo', 'bar'], ['foo'], 3, []];
       shouldPass(d, everyElement(anyOf(isEmpty, contains('foo'))));
@@ -459,7 +461,7 @@
           "at index 2");
     });
 
-    ut.test('anyElement', () {
+    test('anyElement', () {
       var d = [1, 2];
       var e = [1, 1, 1];
       shouldPass(d, anyElement(2));
@@ -467,7 +469,7 @@
           "Expected: some element <2> Actual: [1, 1, 1]");
     });
 
-    ut.test('orderedEquals', () {
+    test('orderedEquals', () {
       shouldPass([null], orderedEquals([null]));
       var d = [1, 2];
       shouldPass(d, orderedEquals([1, 2]));
@@ -477,7 +479,7 @@
           "Which: was <1> instead of <2> at location [0]");
     });
 
-    ut.test('unorderedEquals', () {
+    test('unorderedEquals', () {
       var d = [1, 2];
       shouldPass(d, unorderedEquals([2, 1]));
       shouldFail(d, unorderedEquals([1]),
@@ -494,7 +496,7 @@
           "Which: has no match for <3> at index 0");
     });
 
-    ut.test('unorderedMatchess', () {
+    test('unorderedMatchess', () {
       var d = [1, 2];
       shouldPass(d, unorderedMatches([2, 1]));
       shouldPass(d, unorderedMatches([greaterThan(1), greaterThan(0)]));
@@ -517,7 +519,7 @@
           "Which: has no match for a value greater than <3> at index 0");
     });
 
-    ut.test('pairwise compare', () {
+    test('pairwise compare', () {
       var c = [1, 2];
       var d = [1, 2, 3];
       var e = [1, 4, 9];
@@ -543,9 +545,9 @@
     });
   });
 
-  ut.group('Map Matchers', () {
+  group('Map Matchers', () {
 
-    ut.test('isEmpty', () {
+    test('isEmpty', () {
       var a = new Map();
       shouldPass({}, isEmpty);
       shouldPass(a, isEmpty);
@@ -554,7 +556,7 @@
           "Actual: {'foo': 'bar'}");
     });
 
-    ut.test('equals', () {
+    test('equals', () {
       var a = new Map();
       a['foo'] = 'bar';
       var b = new Map();
@@ -568,7 +570,7 @@
           "Which: is missing map key 'bar'");
     });
 
-    ut.test('equals with different lengths', () {
+    test('equals with different lengths', () {
       var a = new LinkedHashMap();
       a['foo'] = 'bar';
       var b = new LinkedHashMap();
@@ -603,7 +605,7 @@
           "Which: has different length and is missing map key 'foo'");
     });
 
-    ut.test('equals with matcher value', () {
+    test('equals with matcher value', () {
       var a = new Map();
       a['foo'] = 'bar';
       shouldPass(a, equals({'foo': startsWith('ba')}));
@@ -614,7 +616,7 @@
               "at location ['foo']");
     });
 
-    ut.test('contains', () {
+    test('contains', () {
       var a = new Map();
       a['foo'] = 'bar';
       var b = new Map();
@@ -626,7 +628,7 @@
           "Which: is not a string, map or iterable");
     });
 
-    ut.test('containsValue', () {
+    test('containsValue', () {
       var a = new Map();
       a['foo'] = 'bar';
       shouldPass(a, containsValue('bar'));
@@ -635,7 +637,7 @@
           "Actual: {'foo': 'bar'}");
     });
 
-    ut.test('containsPair', () {
+    test('containsPair', () {
       var a = new Map();
       a['foo'] = 'bar';
       shouldPass(a, containsPair('foo', 'bar'));
@@ -650,7 +652,7 @@
           "Which: doesn't contain key 'fo'");
     });
 
-    ut.test('hasLength', () {
+    test('hasLength', () {
       var a = new Map();
       a['foo'] = 'bar';
       var b = new Map();
@@ -662,15 +664,15 @@
     });
   });
 
-  ut.group('Operator Matchers', () {
+  group('Operator Matchers', () {
 
-    ut.test('anyOf', () {
+    test('anyOf', () {
       shouldFail(0, anyOf([equals(1), equals(2)]),
           "Expected: (<1> or <2>) Actual: <0>");
       shouldPass(1, anyOf([equals(1), equals(2)]));
     });
 
-    ut.test('allOf', () {
+    test('allOf', () {
       shouldPass(1, allOf([lessThan(10), greaterThan(0)]));
       shouldFail(-1, allOf([lessThan(10), greaterThan(0)]),
           "Expected: (a value less than <10> and a value greater than <0>) "
@@ -679,9 +681,9 @@
     });
   });
 
-  ut.group('Future Matchers', () {
+  group('Future Matchers', () {
 
-    ut.test('completes - unexpected error', () {
+    test('completes - unexpected error', () {
       var completer = new Completer();
       completer.completeError('X');
       shouldFail(completer.future, completes,
@@ -690,13 +692,13 @@
           isAsync: true);
     });
 
-    ut.test('completes - successfully', () {
+    test('completes - successfully', () {
       var completer = new Completer();
       completer.complete('1');
       shouldPass(completer.future, completes, isAsync: true);
     });
 
-    ut.test('throws - unexpected to see normal completion', () {
+    test('throws - unexpected to see normal completion', () {
       var completer = new Completer();
       completer.complete('1');
       shouldFail(completer.future, throws,
@@ -704,20 +706,20 @@
         isAsync: true);
     });
 
-    ut.test('throws - expected to see exception', () {
+    test('throws - expected to see exception', () {
       var completer = new Completer();
       completer.completeError('X');
       shouldPass(completer.future, throws, isAsync: true);
     });
 
-    ut.test('throws - expected to see exception thrown later on', () {
+    test('throws - expected to see exception thrown later on', () {
       var completer = new Completer();
       var chained = completer.future.then((_) { throw 'X'; });
       shouldPass(chained, throws, isAsync: true);
       completer.complete('1');
     });
 
-    ut.test('throwsA - unexpected normal completion', () {
+    test('throwsA - unexpected normal completion', () {
       var completer = new Completer();
       completer.complete('1');
       shouldFail(completer.future, throwsA(equals('X')),
@@ -725,13 +727,13 @@
         isAsync: true);
     });
 
-    ut.test('throwsA - correct error', () {
+    test('throwsA - correct error', () {
       var completer = new Completer();
       completer.completeError('X');
       shouldPass(completer.future, throwsA(equals('X')), isAsync: true);
     });
 
-    ut.test('throwsA - wrong error', () {
+    test('throwsA - wrong error', () {
       var completer = new Completer();
       completer.completeError('X');
       shouldFail(completer.future, throwsA(equals('Y')),
@@ -742,29 +744,27 @@
     });
   });
 
-  ut.group('Predicate Matchers', () {
-    ut.test('isInstanceOf', () {
+  group('Predicate Matchers', () {
+    test('isInstanceOf', () {
       shouldFail(0, predicate((x) => x is String, "an instance of String"),
           "Expected: an instance of String Actual: <0>");
       shouldPass('cow', predicate((x) => x is String, "an instance of String"));
     });
   });
 
-  ut.group('exception/error matchers', () {
+  group('exception/error matchers', () {
     // TODO(gram): extend this to more types; for now this is just
     // the types being added in this CL.
 
-    // TODO: enable this test when it works.
-    // See issue 12052.
-    ut.skip_test('throwsCyclicInitializationError', () {
-      expect(() => new Bicycle(), throwsCyclicInitializationError);
+    test('throwsCyclicInitializationError', () {
+      expect(() => _Bicycle.foo, throwsCyclicInitializationError);
     });
 
-    ut.test('throwsAbstractClassInstantiationError', () {
-      expect(() => new Abstraction(), throwsAbstractClassInstantiationError);
+    test('throwsAbstractClassInstantiationError', () {
+      expect(() => new _AbstractClass(), throwsAbstractClassInstantiationError);
     });
 
-    ut.test('throwsConcurrentModificationError', () {
+    test('throwsConcurrentModificationError', () {
       expect(() {
         var a = { 'foo': 'bar' };
         for (var k in a.keys) {
@@ -773,11 +773,11 @@
       }, throwsConcurrentModificationError);
       });
 
-    ut.test('throwsNullThrownError', () {
+    test('throwsNullThrownError', () {
       expect(() => throw null, throwsNullThrownError);
     });
 
-    ut.test('throwsFallThroughError', () {
+    test('throwsFallThroughError', () {
       expect(() {
         var a = 0;
         switch (a) {
@@ -791,19 +791,13 @@
   });
 }
 
-class Bicycle {
-  static var foo = bar();
+class _Bicycle {
+  static final foo = bar();
 
   static bar() {
     return foo + 1;
   }
-
-  X() {
-    print(foo);
-  }
 }
 
-abstract class Abstraction {
-  void norealization();
+abstract class _AbstractClass {
 }
-
diff --git a/test/matchers_unminified_test.dart b/test/matchers_unminified_test.dart
index e0629f0..28d97ab 100644
--- a/test/matchers_unminified_test.dart
+++ b/test/matchers_unminified_test.dart
@@ -7,8 +7,10 @@
 // mangled. A version of this file that works in minified dart2js is in
 // matchers_minified_test.dart.
 
+library matcher.unminified_test;
+
 import 'package:matcher/matcher.dart';
-import 'package:unittest/unittest.dart' as ut;
+import 'package:unittest/unittest.dart' show group, test;
 
 import 'test_common.dart';
 import 'test_utils.dart';
@@ -16,8 +18,8 @@
 void main() {
   initUtils();
 
-  ut.group('Core matchers', () {
-    ut.test('throwsFormatException', () {
+  group('Core matchers', () {
+    test('throwsFormatException', () {
       shouldPass(() { throw new FormatException(''); },
           throwsFormatException);
       shouldFail(() { throw new Exception(); },
@@ -29,7 +31,7 @@
 
     });
 
-    ut.test('throwsArgumentError', () {
+    test('throwsArgumentError', () {
       shouldPass(() { throw new ArgumentError(''); },
           throwsArgumentError);
       shouldFail(() { throw new Exception(); },
@@ -40,7 +42,7 @@
               r"Which: threw \?:<Exception>"));
     });
 
-    ut.test('throwsRangeError', () {
+    test('throwsRangeError', () {
       shouldPass(() { throw new RangeError(0); },
           throwsRangeError);
       shouldFail(() { throw new Exception(); },
@@ -51,7 +53,7 @@
               r"Which: threw \?:<Exception>"));
     });
 
-    ut.test('throwsNoSuchMethodError', () {
+    test('throwsNoSuchMethodError', () {
       shouldPass(() {
           throw new NoSuchMethodError(null, const Symbol(''), null, null);
       }, throwsNoSuchMethodError);
@@ -63,7 +65,7 @@
               r"Which: threw \?:<Exception>"));
     });
 
-    ut.test('throwsUnimplementedError', () {
+    test('throwsUnimplementedError', () {
       shouldPass(() { throw new UnimplementedError(''); },
           throwsUnimplementedError);
       shouldFail(() { throw new Exception(); },
@@ -74,7 +76,7 @@
               r"Which: threw \?:<Exception>"));
     });
 
-    ut.test('throwsUnsupportedError', () {
+    test('throwsUnsupportedError', () {
       shouldPass(() { throw new UnsupportedError(''); },
           throwsUnsupportedError);
       shouldFail(() { throw new Exception(); },
@@ -85,7 +87,7 @@
               r"Which: threw \?:<Exception>"));
     });
 
-    ut.test('throwsStateError', () {
+    test('throwsStateError', () {
       shouldPass(() { throw new StateError(''); },
           throwsStateError);
       shouldFail(() { throw new Exception(); },
@@ -97,8 +99,8 @@
     });
   });
 
-  ut.group('Iterable Matchers', () {
-    ut.test('isEmpty', () {
+  group('Iterable Matchers', () {
+    test('isEmpty', () {
       var d = new SimpleIterable(0);
       var e = new SimpleIterable(1);
       shouldPass(d, isEmpty);
@@ -106,7 +108,7 @@
           "Actual: SimpleIterable:[1]");
     });
 
-    ut.test('contains', () {
+    test('contains', () {
       var d = new SimpleIterable(3);
       shouldPass(d, contains(2));
       shouldFail(d, contains(5),
@@ -115,8 +117,8 @@
     });
   });
 
-  ut.group('Feature Matchers', () {
-    ut.test("Feature Matcher", () {
+  group('Feature Matchers', () {
+    test("Feature Matcher", () {
       var w = new Widget();
       w.price = 10;
       shouldPass(w, new HasPrice(10));
diff --git a/test/mirror_matchers_test.dart b/test/mirror_matchers_test.dart
index 6def3f1..ebe90e4 100644
--- a/test/mirror_matchers_test.dart
+++ b/test/mirror_matchers_test.dart
@@ -2,8 +2,10 @@
 // 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 matcher.mirror_test;
+
 import 'package:matcher/mirror_matchers.dart';
-import 'package:unittest/unittest.dart' as ut;
+import 'package:unittest/unittest.dart' show test;
 
 import 'test_utils.dart';
 
@@ -18,7 +20,7 @@
 
   initUtils();
 
-  ut.test('hasProperty', () {
+  test('hasProperty', () {
     var foo = [3];
     shouldPass(foo, hasProperty('length', 1));
     shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" '
diff --git a/test/pretty_print_minified_test.dart b/test/pretty_print_minified_test.dart
index 0758359..f1107f7 100644
--- a/test/pretty_print_minified_test.dart
+++ b/test/pretty_print_minified_test.dart
@@ -7,12 +7,13 @@
 // names will be mangled. This version of the file is modified to expect
 // minified names.
 
-import 'dart:collection';
+library matcher.print_minified_test;
 
-import 'package:unittest/unittest.dart' as ut;
+import 'dart:collection';
 
 import 'package:matcher/matcher.dart';
 import 'package:matcher/src/pretty_print.dart';
+import 'package:unittest/unittest.dart' show test, group;
 
 class DefaultToString {}
 
@@ -32,30 +33,30 @@
 final _minifiedName = r"[A-Za-z0-9]{1,3}";
 
 void main() {
-  ut.group('with an object', () {
-    ut.test('with a default [toString]', () {
+  group('with an object', () {
+    test('with a default [toString]', () {
       expect(prettyPrint(new DefaultToString()),
           matches(r"<Instance of '" + _minifiedName + r"'>"));
     });
 
-    ut.test('with a custom [toString]', () {
+    test('with a custom [toString]', () {
       expect(prettyPrint(new CustomToString()),
           matches(_minifiedName + r':<string representation>'));
     });
 
-    ut.test('with a custom [toString] and a private name', () {
+    test('with a custom [toString] and a private name', () {
       expect(prettyPrint(new _PrivateName()),
           matches(_minifiedName + r':<string representation>'));
     });
   });
 
-  ut.group('with an iterable', () {
-    ut.test("that's not a list", () {
+  group('with an iterable', () {
+    test("that's not a list", () {
       expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)),
           matches(_minifiedName + r":\[2, 4, 6, 8\]"));
     });
 
-    ut.test("that's not a list and has a private name", () {
+    test("that's not a list and has a private name", () {
       expect(prettyPrint(new _PrivateNameIterable()),
           matches(_minifiedName + r":\[1, 2, 3\]"));
     });
diff --git a/test/pretty_print_test.dart b/test/pretty_print_test.dart
index 919bba9..27bbfad 100644
--- a/test/pretty_print_test.dart
+++ b/test/pretty_print_test.dart
@@ -2,13 +2,14 @@
 // 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.
 
-import 'package:unittest/unittest.dart' as ut;
+library matcher.pretty_print_test;
 
 import 'package:matcher/matcher.dart';
 import 'package:matcher/src/pretty_print.dart';
+import 'package:unittest/unittest.dart' show group, test;
 
 void main() {
-  ut.test('with primitive objects', () {
+  test('with primitive objects', () {
     expect(prettyPrint(12), equals('<12>'));
     expect(prettyPrint(12.13), equals('<12.13>'));
     expect(prettyPrint(true), equals('<true>'));
@@ -17,30 +18,30 @@
         matches(r'<Closure(: \(\) => dynamic)?>'));
   });
 
-  ut.group('with a string', () {
-    ut.test('containing simple characters', () {
+  group('with a string', () {
+    test('containing simple characters', () {
       expect(prettyPrint('foo'), equals("'foo'"));
     });
 
-    ut.test('containing newlines', () {
+    test('containing newlines', () {
       expect(prettyPrint('foo\nbar\nbaz'), equals(
           "'foo\\n'\n"
           "  'bar\\n'\n"
           "  'baz'"));
     });
 
-    ut.test('containing escapable characters', () {
+    test('containing escapable characters', () {
       expect(prettyPrint("foo\rbar\tbaz'qux"),
           equals("'foo\\rbar\\tbaz\\'qux'"));
     });
   });
 
-  ut.group('with an iterable', () {
-    ut.test('containing primitive objects', () {
+  group('with an iterable', () {
+    test('containing primitive objects', () {
       expect(prettyPrint([1, true, 'foo']), equals("[1, true, 'foo']"));
     });
 
-    ut.test('containing a multiline string', () {
+    test('containing a multiline string', () {
       expect(prettyPrint(['foo', 'bar\nbaz\nbip', 'qux']), equals("[\n"
           "  'foo',\n"
           "  'bar\\n'\n"
@@ -50,17 +51,17 @@
           "]"));
     });
 
-    ut.test('containing a matcher', () {
+    test('containing a matcher', () {
       expect(prettyPrint(['foo', endsWith('qux')]),
           equals("['foo', <a string ending with 'qux'>]"));
     });
 
-    ut.test("that's under maxLineLength", () {
+    test("that's under maxLineLength", () {
       expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 30),
           equals("[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"));
     });
 
-    ut.test("that's over maxLineLength", () {
+    test("that's over maxLineLength", () {
       expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 29),
           equals("[\n"
               "  0,\n"
@@ -76,7 +77,7 @@
               "]"));
     });
 
-    ut.test("factors indentation into maxLineLength", () {
+    test("factors indentation into maxLineLength", () {
       expect(prettyPrint([
         "foo\nbar",
         [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
@@ -98,30 +99,30 @@
           "]"));
     });
 
-    ut.test("that's under maxItems", () {
+    test("that's under maxItems", () {
       expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxItems: 10),
           equals("[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"));
     });
 
-    ut.test("that's over maxItems", () {
+    test("that's over maxItems", () {
       expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxItems: 9),
           equals("[0, 1, 2, 3, 4, 5, 6, 7, ...]"));
     });
 
-    ut.test("that's recursive", () {
+    test("that's recursive", () {
       var list = [1, 2, 3];
       list.add(list);
       expect(prettyPrint(list), equals("[1, 2, 3, (recursive)]"));
     });
   });
 
-  ut.group("with a map", () {
-    ut.test('containing primitive objects', () {
+  group("with a map", () {
+    test('containing primitive objects', () {
       expect(prettyPrint({'foo': 1, 'bar': true}),
           equals("{'foo': 1, 'bar': true}"));
     });
 
-    ut.test('containing a multiline string key', () {
+    test('containing a multiline string key', () {
       expect(prettyPrint({'foo\nbar': 1, 'bar': true}), equals("{\n"
           "  'foo\\n'\n"
           "    'bar': 1,\n"
@@ -129,7 +130,7 @@
           "}"));
     });
 
-    ut.test('containing a multiline string value', () {
+    test('containing a multiline string value', () {
       expect(prettyPrint({'foo': 'bar\nbaz', 'qux': true}), equals("{\n"
           "  'foo': 'bar\\n'\n"
           "    'baz',\n"
@@ -137,7 +138,7 @@
           "}"));
     });
 
-    ut.test('containing a multiline string key/value pair', () {
+    test('containing a multiline string key/value pair', () {
       expect(prettyPrint({'foo\nbar': 'baz\nqux'}), equals("{\n"
           "  'foo\\n'\n"
           "    'bar': 'baz\\n'\n"
@@ -145,22 +146,22 @@
           "}"));
     });
 
-    ut.test('containing a matcher key', () {
+    test('containing a matcher key', () {
       expect(prettyPrint({endsWith('bar'): 'qux'}),
           equals("{<a string ending with 'bar'>: 'qux'}"));
     });
 
-    ut.test('containing a matcher value', () {
+    test('containing a matcher value', () {
       expect(prettyPrint({'foo': endsWith('qux')}),
           equals("{'foo': <a string ending with 'qux'>}"));
     });
 
-    ut.test("that's under maxLineLength", () {
+    test("that's under maxLineLength", () {
       expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 32),
           equals("{'0': 1, '2': 3, '4': 5, '6': 7}"));
     });
 
-    ut.test("that's over maxLineLength", () {
+    test("that's over maxLineLength", () {
       expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 31),
           equals("{\n"
               "  '0': 1,\n"
@@ -170,7 +171,7 @@
               "}"));
     });
 
-    ut.test("factors indentation into maxLineLength", () {
+    test("factors indentation into maxLineLength", () {
       expect(prettyPrint(["foo\nbar", {'0': 1, '2': 3, '4': 5, '6': 7}],
               maxLineLength: 32),
           equals("[\n"
@@ -185,12 +186,12 @@
               "]"));
     });
 
-    ut.test("that's under maxItems", () {
+    test("that's under maxItems", () {
       expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 4),
           equals("{'0': 1, '2': 3, '4': 5, '6': 7}"));
     });
 
-    ut.test("that's over maxItems", () {
+    test("that's over maxItems", () {
       expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 3),
           equals("{'0': 1, '2': 3, ...}"));
     });
diff --git a/test/pretty_print_unminified_test.dart b/test/pretty_print_unminified_test.dart
index 5f46fd7..81e7db5 100644
--- a/test/pretty_print_unminified_test.dart
+++ b/test/pretty_print_unminified_test.dart
@@ -7,11 +7,13 @@
 // will be mangled. A version of this file that works in minified dart2js is in
 // pretty_print_minified_test.dart.
 
+library matcher.print_unminified_test;
+
 import 'dart:collection';
-import 'package:unittest/unittest.dart' as ut;
 
 import 'package:matcher/matcher.dart';
 import 'package:matcher/src/pretty_print.dart';
+import 'package:unittest/unittest.dart' show test, group;
 
 class DefaultToString {}
 
@@ -28,30 +30,30 @@
 }
 
 void main() {
-  ut.group('with an object', () {
-    ut.test('with a default [toString]', () {
+  group('with an object', () {
+    test('with a default [toString]', () {
       expect(prettyPrint(new DefaultToString()),
           equals("<Instance of 'DefaultToString'>"));
     });
 
-    ut.test('with a custom [toString]', () {
+    test('with a custom [toString]', () {
       expect(prettyPrint(new CustomToString()),
           equals('CustomToString:<string representation>'));
     });
 
-    ut.test('with a custom [toString] and a private name', () {
+    test('with a custom [toString] and a private name', () {
       expect(prettyPrint(new _PrivateName()),
           equals('?:<string representation>'));
     });
   });
 
-  ut.group('with an iterable', () {
-    ut.test("that's not a list", () {
+  group('with an iterable', () {
+    test("that's not a list", () {
       expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)),
           equals("MappedListIterable:[2, 4, 6, 8]"));
     });
 
-    ut.test("that's not a list and has a private name", () {
+    test("that's not a list and has a private name", () {
       expect(prettyPrint(new _PrivateNameIterable()),
           equals("?:[1, 2, 3]"));
     });
diff --git a/test/test_common.dart b/test/test_common.dart
index 291033c..562786d 100644
--- a/test/test_common.dart
+++ b/test/test_common.dart
@@ -2,7 +2,7 @@
 // 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_common;
+library matcher.test_common;
 
 import 'dart:collection';
 
diff --git a/test/test_utils.dart b/test/test_utils.dart
index fba527a..c29bec9 100644
--- a/test/test_utils.dart
+++ b/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 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 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();
   }