Update package:test dependencies to `0.12.18+2` (#8247)
diff --git a/dev/devicelab/pubspec.yaml b/dev/devicelab/pubspec.yaml index f262f0e..a0673dc 100644 --- a/dev/devicelab/pubspec.yaml +++ b/dev/devicelab/pubspec.yaml
@@ -16,4 +16,4 @@ dev_dependencies: # See packages/flutter_test/pubspec.yaml for why we're pinning this version. - test: 0.12.15+9 + test: 0.12.18+2
diff --git a/packages/flutter/test/animation/curves_test.dart b/packages/flutter/test/animation/curves_test.dart index ed5ae36..8b133bb0 100644 --- a/packages/flutter/test/animation/curves_test.dart +++ b/packages/flutter/test/animation/curves_test.dart
@@ -105,35 +105,35 @@ }); test('Invalid transform parameter should assert', () { - expect(() => const SawTooth(2).transform(-0.0001), throws); - expect(() => const SawTooth(2).transform(1.0001), throws); + expect(() => const SawTooth(2).transform(-0.0001), throwsAssertionError); + expect(() => const SawTooth(2).transform(1.0001), throwsAssertionError); - expect(() => const Interval(0.0, 1.0).transform(-0.0001), throws); - expect(() => const Interval(0.0, 1.0).transform(1.0001), throws); + expect(() => const Interval(0.0, 1.0).transform(-0.0001), throwsAssertionError); + expect(() => const Interval(0.0, 1.0).transform(1.0001), throwsAssertionError); - expect(() => const Threshold(0.5).transform(-0.0001), throws); - expect(() => const Threshold(0.5).transform(1.0001), throws); + expect(() => const Threshold(0.5).transform(-0.0001), throwsAssertionError); + expect(() => const Threshold(0.5).transform(1.0001), throwsAssertionError); - expect(() => const ElasticInCurve().transform(-0.0001), throws); - expect(() => const ElasticInCurve().transform(1.0001), throws); + expect(() => const ElasticInCurve().transform(-0.0001), throwsAssertionError); + expect(() => const ElasticInCurve().transform(1.0001), throwsAssertionError); - expect(() => const ElasticOutCurve().transform(-0.0001), throws); - expect(() => const ElasticOutCurve().transform(1.0001), throws); + expect(() => const ElasticOutCurve().transform(-0.0001), throwsAssertionError); + expect(() => const ElasticOutCurve().transform(1.0001), throwsAssertionError); - expect(() => const Cubic(0.42, 0.0, 0.58, 1.0).transform(-0.0001), throws); - expect(() => const Cubic(0.42, 0.0, 0.58, 1.0).transform(1.0001), throws); + expect(() => const Cubic(0.42, 0.0, 0.58, 1.0).transform(-0.0001), throwsAssertionError); + expect(() => const Cubic(0.42, 0.0, 0.58, 1.0).transform(1.0001), throwsAssertionError); - expect(() => Curves.decelerate.transform(-0.0001), throws); - expect(() => Curves.decelerate.transform(1.0001), throws); + expect(() => Curves.decelerate.transform(-0.0001), throwsAssertionError); + expect(() => Curves.decelerate.transform(1.0001), throwsAssertionError); - expect(() => Curves.bounceIn.transform(-0.0001), throws); - expect(() => Curves.bounceIn.transform(1.0001), throws); + expect(() => Curves.bounceIn.transform(-0.0001), throwsAssertionError); + expect(() => Curves.bounceIn.transform(1.0001), throwsAssertionError); - expect(() => Curves.bounceOut.transform(-0.0001), throws); - expect(() => Curves.bounceOut.transform(1.0001), throws); + expect(() => Curves.bounceOut.transform(-0.0001), throwsAssertionError); + expect(() => Curves.bounceOut.transform(1.0001), throwsAssertionError); - expect(() => Curves.bounceInOut.transform(-0.0001), throws); - expect(() => Curves.bounceInOut.transform(1.0001), throws); + expect(() => Curves.bounceInOut.transform(-0.0001), throwsAssertionError); + expect(() => Curves.bounceInOut.transform(1.0001), throwsAssertionError); }); }
diff --git a/packages/flutter/test/foundation/covariant_templates_test.dart b/packages/flutter/test/foundation/covariant_templates_test.dart index a5f77e5..885adbf 100644 --- a/packages/flutter/test/foundation/covariant_templates_test.dart +++ b/packages/flutter/test/foundation/covariant_templates_test.dart
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:test/test.dart'; +import 'package:flutter_test/flutter_test.dart'; class X {} @@ -18,6 +18,6 @@ A<X> ayAsAx = ay; expect(() { ayAsAx.u = new X(); - }, throws); + }, throwsAssertionError); }); }
diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index 9ae396c..dc7f488 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart
@@ -14,7 +14,7 @@ fontWeight: FontWeight.w800, height: 123.0, ); - expect(() { s1.fontFamily = 'test'; }, throws); // ignore: ASSIGNMENT_TO_FINAL + expect(() { s1.fontFamily = 'test'; }, throwsA(isNoSuchMethodError)); // ignore: ASSIGNMENT_TO_FINAL expect(s1.fontFamily, isNull); expect(s1.fontSize, 10.0); expect(s1.fontWeight, FontWeight.w800);
diff --git a/packages/flutter/test/scheduler/debug_test.dart b/packages/flutter/test/scheduler/debug_test.dart index 697af80..aa8e4a5 100644 --- a/packages/flutter/test/scheduler/debug_test.dart +++ b/packages/flutter/test/scheduler/debug_test.dart
@@ -3,31 +3,31 @@ // found in the LICENSE file. import 'package:flutter/scheduler.dart'; -import 'package:test/test.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('debugAssertAllSchedulerVarsUnset control test', () { expect(() { debugAssertAllSchedulerVarsUnset('Example test'); - }, isNot(throws)); + }, isNot(throwsFlutterError)); debugPrintBeginFrameBanner = true; expect(() { debugAssertAllSchedulerVarsUnset('Example test'); - }, throws); + }, throwsFlutterError); debugPrintBeginFrameBanner = false; debugPrintEndFrameBanner = true; expect(() { debugAssertAllSchedulerVarsUnset('Example test'); - }, throws); + }, throwsFlutterError); debugPrintEndFrameBanner = false; expect(() { debugAssertAllSchedulerVarsUnset('Example test'); - }, isNot(throws)); + }, isNot(throwsFlutterError)); }); }
diff --git a/packages/flutter/test/widgets/notification_test.dart b/packages/flutter/test/widgets/notification_test.dart index 12be099..3e153e8 100644 --- a/packages/flutter/test/widgets/notification_test.dart +++ b/packages/flutter/test/widgets/notification_test.dart
@@ -66,6 +66,6 @@ onNotification: (MyNotification value) { }, child: new Container(key: key), )); - expect(() { new MyNotification().dispatch(key.currentContext); }, throwsA(const isInstanceOf<AssertionError>())); + expect(() { new MyNotification().dispatch(key.currentContext); }, throwsAssertionError); }); }
diff --git a/packages/flutter/test/widgets/scroll_controller_test.dart b/packages/flutter/test/widgets/scroll_controller_test.dart index 9f091b9..1533abd 100644 --- a/packages/flutter/test/widgets/scroll_controller_test.dart +++ b/packages/flutter/test/widgets/scroll_controller_test.dart
@@ -76,12 +76,12 @@ }).toList() )); - expect(() => controller.offset, throws); + expect(() => controller.offset, throwsAssertionError); expect(controller2.offset, equals(653.0)); expect(realOffset(), equals(controller2.offset)); - expect(() => controller.jumpTo(120.0), throws); - expect(() => controller.animateTo(132.0, duration: const Duration(milliseconds: 300), curve: Curves.ease), throws); + expect(() => controller.jumpTo(120.0), throwsAssertionError); + expect(() => controller.animateTo(132.0, duration: const Duration(milliseconds: 300), curve: Curves.ease), throwsAssertionError); await tester.pumpWidget(new ListView( key: const Key('second'),
diff --git a/packages/flutter/test/widgets/set_state_4_test.dart b/packages/flutter/test/widgets/set_state_4_test.dart index 84a2816..88b4819 100644 --- a/packages/flutter/test/widgets/set_state_4_test.dart +++ b/packages/flutter/test/widgets/set_state_4_test.dart
@@ -23,8 +23,8 @@ testWidgets('setState() catches being used with an async callback', (WidgetTester tester) async { await tester.pumpWidget(new Changer()); ChangerState s = tester.state(find.byType(Changer)); - expect(s.test0, isNot(throws)); - expect(s.test1, isNot(throws)); - expect(s.test2, throws); + expect(s.test0, isNot(throwsFlutterError)); + expect(s.test1, isNot(throwsFlutterError)); + expect(s.test2, throwsFlutterError); }); }
diff --git a/packages/flutter_driver/pubspec.yaml b/packages/flutter_driver/pubspec.yaml index 7d3babd..b43ccbe 100644 --- a/packages/flutter_driver/pubspec.yaml +++ b/packages/flutter_driver/pubspec.yaml
@@ -20,6 +20,6 @@ sdk: flutter dev_dependencies: - test: 0.12.15+9 + test: 0.12.18+2 mockito: ^1.0.0 quiver: ^0.24.0
diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index 1ca742f..9b48366 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart
@@ -67,11 +67,17 @@ const Matcher hasOneLineDescription = const _HasOneLineDescription(); /// A matcher for functions that throw [FlutterError]. -const Matcher throwsFlutterError = const Throws(isFlutterError); +Matcher throwsFlutterError = throwsA(isFlutterError); + +/// A matcher for functions that throw [AssertionError]. +Matcher throwsAssertionError = throwsA(isAssertionError); /// A matcher for [FlutterError]. const Matcher isFlutterError = const isInstanceOf<FlutterError>(); +/// A matcher for [AssertionError]. +const Matcher isAssertionError = const isInstanceOf<AssertionError>(); + /// Asserts that two [double]s are equal, within some tolerated error. /// /// Two values are considered equal if the difference between them is within
diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index de1bf07..1c7a823 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart
@@ -120,10 +120,9 @@ void expect(dynamic actual, dynamic matcher, { String reason, bool verbose: false, - dynamic formatter }) { TestAsyncUtils.guardSync(); - test_package.expect(actual, matcher, reason: reason, verbose: verbose, formatter: formatter); + test_package.expect(actual, matcher, reason: reason, verbose: verbose); } /// Assert that `actual` matches `matcher`. @@ -138,9 +137,8 @@ void expectSync(dynamic actual, dynamic matcher, { String reason, bool verbose: false, - dynamic formatter }) { - test_package.expect(actual, matcher, reason: reason, verbose: verbose, formatter: formatter); + test_package.expect(actual, matcher, reason: reason, verbose: verbose); } /// Class that programmatically interacts with widgets and the test environment.
diff --git a/packages/flutter_test/pubspec.yaml b/packages/flutter_test/pubspec.yaml index 69a666e..4d5e7e1 100644 --- a/packages/flutter_test/pubspec.yaml +++ b/packages/flutter_test/pubspec.yaml
@@ -5,7 +5,7 @@ # The flutter tools depend on very specific internal implementation # details of the 'test' package, which change between versions, so # here we pin it precisely to avoid version skew across our packages. - test: 0.12.15+9 + test: 0.12.18+2 flutter: sdk: flutter
diff --git a/packages/flutter_tools/pubspec.yaml b/packages/flutter_tools/pubspec.yaml index 4909a8e..d16ced8 100644 --- a/packages/flutter_tools/pubspec.yaml +++ b/packages/flutter_tools/pubspec.yaml
@@ -34,7 +34,7 @@ # We depend on very specific internal implementation details of the # 'test' package, which change between versions, so here we pin it # precisely. - test: 0.12.15+9 + test: 0.12.18+2 # Version from the vended Dart SDK as defined in `dependency_overrides`. analyzer: any
diff --git a/packages/flutter_tools/test/drive_test.dart b/packages/flutter_tools/test/drive_test.dart index 05bbe68..0acef18 100644 --- a/packages/flutter_tools/test/drive_test.dart +++ b/packages/flutter_tools/test/drive_test.dart
@@ -88,7 +88,7 @@ testUsingContext('returns 1 when app fails to run', () async { withMockDevice(); - appStarter = expectAsync((DriveCommand command) async => null); + appStarter = expectAsync1((DriveCommand command) async => null); String testApp = fs.path.join(cwd.path, 'test_driver', 'e2e.dart'); String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.dart'); @@ -157,14 +157,14 @@ String testApp = fs.path.join(cwd.path, 'test', 'e2e.dart'); String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.dart'); - appStarter = expectAsync((DriveCommand command) async { + appStarter = expectAsync1((DriveCommand command) async { return new LaunchResult.succeeded(); }); - testRunner = expectAsync((List<String> testArgs, String observatoryUri) async { + testRunner = expectAsync2((List<String> testArgs, String observatoryUri) async { expect(testArgs, <String>[testFile]); return null; }); - appStopper = expectAsync((DriveCommand command) async { + appStopper = expectAsync1((DriveCommand command) async { return true; }); @@ -188,13 +188,13 @@ String testApp = fs.path.join(cwd.path, 'test', 'e2e.dart'); String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.dart'); - appStarter = expectAsync((DriveCommand command) async { + appStarter = expectAsync1((DriveCommand command) async { return new LaunchResult.succeeded(); }); testRunner = (List<String> testArgs, String observatoryUri) async { throwToolExit(null, exitCode: 123); }; - appStopper = expectAsync((DriveCommand command) async { + appStopper = expectAsync1((DriveCommand command) async { return true; });
diff --git a/packages/flutter_tools/test/src/common.dart b/packages/flutter_tools/test/src/common.dart index d13fcf2..4a4976a 100644 --- a/packages/flutter_tools/test/src/common.dart +++ b/packages/flutter_tools/test/src/common.dart
@@ -37,8 +37,8 @@ /// Matcher for functions that throw ToolExit. Matcher throwsToolExit([int exitCode]) { return exitCode == null - ? const Throws(isToolExit) - : new Throws(allOf(isToolExit, (ToolExit e) => e.exitCode == exitCode)); + ? throwsA(isToolExit) + : throwsA(allOf(isToolExit, (ToolExit e) => e.exitCode == exitCode)); } /// Matcher for [ToolExit]s.