diff --git a/lib/src/test_case.dart b/lib/src/test_case.dart index fe0d12de644455db83b0e0d5803a06f5a50d17b6..9f2a6320d1352c3d04d6fb9c6e4017750e0f5bbe 100644 --- a/lib/src/test_case.dart +++ b/lib/src/test_case.dart @@ -15,13 +15,13 @@ class TestCase { final String description; /// The setup function to call before the test, if any. - final Function _setUp; + Function _setUp; /// The teardown function to call after the test, if any. - final Function _tearDown; + Function _tearDown; /// The body of the test case. - final TestFunction _testFunction; + TestFunction _testFunction; /// Remaining number of callbacks functions that must reach a 'done' state /// to wait for before the test completes. @@ -120,7 +120,11 @@ class TestCase { } else if (_tearDown != null) { return _tearDown(); } - }).catchError(_errorHandler('Teardown')); + }).catchError(_errorHandler('Teardown')).whenComplete(() { + _setUp = null; + _tearDown = null; + _testFunction = null; + }); } // Set the results, notify the config, and return true if this diff --git a/pubspec.yaml b/pubspec.yaml index 0a36d5cac419278c01f57af06f5d688e74ba7169..b531c81246b5a1d417d6f5f709ee61dc8e250d52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: unittest -version: 0.11.0+4 +version: 0.11.0+5 author: Dart Team <misc@dartlang.org> description: A library for writing dart unit tests. homepage: https://pub.dartlang.org/packages/unittest