Fix the deprecated expectAsync() method. (#514)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e9ebe0..9881978 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 0.12.18+1
+
+* Fix the deprecated `expectAsync()` function. The deprecation caused it to
+  fail to support functions that take arguments.
+
 ## 0.12.18
 
 * Add an `addTearDown()` function, which allows tests to register additional
diff --git a/lib/src/frontend/expect_async.dart b/lib/src/frontend/expect_async.dart
index a5c997c..b0c0063 100644
--- a/lib/src/frontend/expect_async.dart
+++ b/lib/src/frontend/expect_async.dart
@@ -10,7 +10,8 @@
 /// An object used to detect unpassed arguments.
 const _PLACEHOLDER = const Object();
 
-// Functions used to check how many arguments a callback takes.
+// Function types returned by expectAsync# methods.
+
 typedef T Func0<T>();
 typedef T Func1<T, A>([A a]);
 typedef T Func2<T, A, B>([A a, B b]);
@@ -19,6 +20,18 @@
 typedef T Func5<T, A, B, C, D, E>([A a, B b, C c, D d, E e]);
 typedef T Func6<T, A, B, C, D, E, F>([A a, B b, C c, D d, E e, F f]);
 
+// Functions used to check how many arguments a callback takes. We can't use the
+// previous functions for this, because (a) {} is not a subtype of
+// ([dynamic]) -> dynamic.
+
+typedef _Func0();
+typedef _Func1(A a);
+typedef _Func2(A a, B b);
+typedef _Func3(A a, B b, C c);
+typedef _Func4(A a, B b, C c, D d);
+typedef _Func5(A a, B b, C c, D d, E e);
+typedef _Func6(A a, B b, C c, D d, E e, F f);
+
 typedef bool _IsDoneCallback();
 
 /// A wrapper for a function that ensures that it's called the appropriate
@@ -128,13 +141,13 @@
   /// Returns a function that has the same number of positional arguments as the
   /// wrapped function (up to a total of 6).
   Function get func {
-    if (_callback is Func6) return max6;
-    if (_callback is Func5) return max5;
-    if (_callback is Func4) return max4;
-    if (_callback is Func3) return max3;
-    if (_callback is Func2) return max2;
-    if (_callback is Func1) return max1;
-    if (_callback is Func0) return max0;
+    if (_callback is _Func6) return max6;
+    if (_callback is _Func5) return max5;
+    if (_callback is _Func4) return max4;
+    if (_callback is _Func3) return max3;
+    if (_callback is _Func2) return max2;
+    if (_callback is _Func1) return max1;
+    if (_callback is _Func0) return max0;
 
     _invoker.removeOutstandingCallback();
     throw new ArgumentError(
diff --git a/pubspec.yaml b/pubspec.yaml
index 927a8d3..150ab3d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test
-version: 0.12.18
+version: 0.12.18+1
 author: Dart Team <misc@dartlang.org>
 description: A library for writing dart unit tests.
 homepage: https://github.com/dart-lang/test
diff --git a/test/frontend/expect_async_test.dart b/test/frontend/expect_async_test.dart
index d647102..2bc5330 100644
--- a/test/frontend/expect_async_test.dart
+++ b/test/frontend/expect_async_test.dart
@@ -145,11 +145,6 @@
     });
   });
 
-  test("doesn't support a function with 7 arguments", () {
-    expect(() => expectAsync((_1, _2, _3, _4, _5, _6, _7) {}),
-        throwsArgumentError);
-  });
-
   group("by default", () {
     test("won't allow the test to complete until it's called", () {
       return expectTestBlocks(
@@ -329,4 +324,35 @@
       expect(caughtError, isFalse);
     });
   });
+
+  group("old-style expectAsync()", () {
+    test("works with no arguments", () async {
+      var callbackRun = false;
+      var liveTest = await runTestBody(() {
+        expectAsync(() {
+          callbackRun = true;
+        })();
+      });
+
+      expectTestPassed(liveTest);
+      expect(callbackRun, isTrue);
+    });
+
+    test("works with arguments", () async {
+      var callbackRun = false;
+      var liveTest = await runTestBody(() {
+        expectAsync((arg1, arg2) {
+          callbackRun = true;
+        })(1, 2);
+      });
+
+      expectTestPassed(liveTest);
+      expect(callbackRun, isTrue);
+    });
+
+    test("doesn't support a function with 7 arguments", () {
+      expect(() => expectAsync((_1, _2, _3, _4, _5, _6, _7) {}),
+          throwsArgumentError);
+    });
+  });
 }