Commit c233f382 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Update package:test dependencies to `0.12.18+2` (#8247)

parent 4e531f64
...@@ -16,4 +16,4 @@ dependencies: ...@@ -16,4 +16,4 @@ dependencies:
dev_dependencies: dev_dependencies:
# See packages/flutter_test/pubspec.yaml for why we're pinning this version. # See packages/flutter_test/pubspec.yaml for why we're pinning this version.
test: 0.12.15+9 test: 0.12.18+2
...@@ -105,35 +105,35 @@ void main() { ...@@ -105,35 +105,35 @@ void main() {
}); });
test('Invalid transform parameter should assert', () { test('Invalid transform parameter should assert', () {
expect(() => const SawTooth(2).transform(-0.0001), throws); expect(() => const SawTooth(2).transform(-0.0001), throwsAssertionError);
expect(() => const SawTooth(2).transform(1.0001), throws); 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(-0.0001), throwsAssertionError);
expect(() => const Interval(0.0, 1.0).transform(1.0001), throws); 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(-0.0001), throwsAssertionError);
expect(() => const Threshold(0.5).transform(1.0001), throws); expect(() => const Threshold(0.5).transform(1.0001), throwsAssertionError);
expect(() => const ElasticInCurve().transform(-0.0001), throws); expect(() => const ElasticInCurve().transform(-0.0001), throwsAssertionError);
expect(() => const ElasticInCurve().transform(1.0001), throws); expect(() => const ElasticInCurve().transform(1.0001), throwsAssertionError);
expect(() => const ElasticOutCurve().transform(-0.0001), throws); expect(() => const ElasticOutCurve().transform(-0.0001), throwsAssertionError);
expect(() => const ElasticOutCurve().transform(1.0001), throws); 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(-0.0001), throwsAssertionError);
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(1.0001), throwsAssertionError);
expect(() => Curves.decelerate.transform(-0.0001), throws); expect(() => Curves.decelerate.transform(-0.0001), throwsAssertionError);
expect(() => Curves.decelerate.transform(1.0001), throws); expect(() => Curves.decelerate.transform(1.0001), throwsAssertionError);
expect(() => Curves.bounceIn.transform(-0.0001), throws); expect(() => Curves.bounceIn.transform(-0.0001), throwsAssertionError);
expect(() => Curves.bounceIn.transform(1.0001), throws); expect(() => Curves.bounceIn.transform(1.0001), throwsAssertionError);
expect(() => Curves.bounceOut.transform(-0.0001), throws); expect(() => Curves.bounceOut.transform(-0.0001), throwsAssertionError);
expect(() => Curves.bounceOut.transform(1.0001), throws); expect(() => Curves.bounceOut.transform(1.0001), throwsAssertionError);
expect(() => Curves.bounceInOut.transform(-0.0001), throws); expect(() => Curves.bounceInOut.transform(-0.0001), throwsAssertionError);
expect(() => Curves.bounceInOut.transform(1.0001), throws); expect(() => Curves.bounceInOut.transform(1.0001), throwsAssertionError);
}); });
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:test/test.dart'; import 'package:flutter_test/flutter_test.dart';
class X {} class X {}
...@@ -18,6 +18,6 @@ void main() { ...@@ -18,6 +18,6 @@ void main() {
A<X> ayAsAx = ay; A<X> ayAsAx = ay;
expect(() { expect(() {
ayAsAx.u = new X(); ayAsAx.u = new X();
}, throws); }, throwsAssertionError);
}); });
} }
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
height: 123.0, 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.fontFamily, isNull);
expect(s1.fontSize, 10.0); expect(s1.fontSize, 10.0);
expect(s1.fontWeight, FontWeight.w800); expect(s1.fontWeight, FontWeight.w800);
......
...@@ -3,31 +3,31 @@ ...@@ -3,31 +3,31 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:test/test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('debugAssertAllSchedulerVarsUnset control test', () { test('debugAssertAllSchedulerVarsUnset control test', () {
expect(() { expect(() {
debugAssertAllSchedulerVarsUnset('Example test'); debugAssertAllSchedulerVarsUnset('Example test');
}, isNot(throws)); }, isNot(throwsFlutterError));
debugPrintBeginFrameBanner = true; debugPrintBeginFrameBanner = true;
expect(() { expect(() {
debugAssertAllSchedulerVarsUnset('Example test'); debugAssertAllSchedulerVarsUnset('Example test');
}, throws); }, throwsFlutterError);
debugPrintBeginFrameBanner = false; debugPrintBeginFrameBanner = false;
debugPrintEndFrameBanner = true; debugPrintEndFrameBanner = true;
expect(() { expect(() {
debugAssertAllSchedulerVarsUnset('Example test'); debugAssertAllSchedulerVarsUnset('Example test');
}, throws); }, throwsFlutterError);
debugPrintEndFrameBanner = false; debugPrintEndFrameBanner = false;
expect(() { expect(() {
debugAssertAllSchedulerVarsUnset('Example test'); debugAssertAllSchedulerVarsUnset('Example test');
}, isNot(throws)); }, isNot(throwsFlutterError));
}); });
} }
...@@ -66,6 +66,6 @@ void main() { ...@@ -66,6 +66,6 @@ void main() {
onNotification: (MyNotification value) { }, onNotification: (MyNotification value) { },
child: new Container(key: key), child: new Container(key: key),
)); ));
expect(() { new MyNotification().dispatch(key.currentContext); }, throwsA(const isInstanceOf<AssertionError>())); expect(() { new MyNotification().dispatch(key.currentContext); }, throwsAssertionError);
}); });
} }
...@@ -76,12 +76,12 @@ void main() { ...@@ -76,12 +76,12 @@ void main() {
}).toList() }).toList()
)); ));
expect(() => controller.offset, throws); expect(() => controller.offset, throwsAssertionError);
expect(controller2.offset, equals(653.0)); expect(controller2.offset, equals(653.0));
expect(realOffset(), equals(controller2.offset)); expect(realOffset(), equals(controller2.offset));
expect(() => controller.jumpTo(120.0), throws); expect(() => controller.jumpTo(120.0), throwsAssertionError);
expect(() => controller.animateTo(132.0, duration: const Duration(milliseconds: 300), curve: Curves.ease), throws); expect(() => controller.animateTo(132.0, duration: const Duration(milliseconds: 300), curve: Curves.ease), throwsAssertionError);
await tester.pumpWidget(new ListView( await tester.pumpWidget(new ListView(
key: const Key('second'), key: const Key('second'),
......
...@@ -23,8 +23,8 @@ void main() { ...@@ -23,8 +23,8 @@ void main() {
testWidgets('setState() catches being used with an async callback', (WidgetTester tester) async { testWidgets('setState() catches being used with an async callback', (WidgetTester tester) async {
await tester.pumpWidget(new Changer()); await tester.pumpWidget(new Changer());
ChangerState s = tester.state(find.byType(Changer)); ChangerState s = tester.state(find.byType(Changer));
expect(s.test0, isNot(throws)); expect(s.test0, isNot(throwsFlutterError));
expect(s.test1, isNot(throws)); expect(s.test1, isNot(throwsFlutterError));
expect(s.test2, throws); expect(s.test2, throwsFlutterError);
}); });
} }
...@@ -20,6 +20,6 @@ dependencies: ...@@ -20,6 +20,6 @@ dependencies:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
test: 0.12.15+9 test: 0.12.18+2
mockito: ^1.0.0 mockito: ^1.0.0
quiver: ^0.24.0 quiver: ^0.24.0
...@@ -67,11 +67,17 @@ const Matcher isNotInCard = const _IsNotInCard(); ...@@ -67,11 +67,17 @@ const Matcher isNotInCard = const _IsNotInCard();
const Matcher hasOneLineDescription = const _HasOneLineDescription(); const Matcher hasOneLineDescription = const _HasOneLineDescription();
/// A matcher for functions that throw [FlutterError]. /// 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]. /// A matcher for [FlutterError].
const Matcher isFlutterError = const isInstanceOf<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. /// Asserts that two [double]s are equal, within some tolerated error.
/// ///
/// Two values are considered equal if the difference between them is within /// Two values are considered equal if the difference between them is within
......
...@@ -120,10 +120,9 @@ Future<Null> benchmarkWidgets(WidgetTesterCallback callback) { ...@@ -120,10 +120,9 @@ Future<Null> benchmarkWidgets(WidgetTesterCallback callback) {
void expect(dynamic actual, dynamic matcher, { void expect(dynamic actual, dynamic matcher, {
String reason, String reason,
bool verbose: false, bool verbose: false,
dynamic formatter
}) { }) {
TestAsyncUtils.guardSync(); 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`. /// Assert that `actual` matches `matcher`.
...@@ -138,9 +137,8 @@ void expect(dynamic actual, dynamic matcher, { ...@@ -138,9 +137,8 @@ void expect(dynamic actual, dynamic matcher, {
void expectSync(dynamic actual, dynamic matcher, { void expectSync(dynamic actual, dynamic matcher, {
String reason, String reason,
bool verbose: false, 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. /// Class that programmatically interacts with widgets and the test environment.
......
...@@ -5,7 +5,7 @@ dependencies: ...@@ -5,7 +5,7 @@ dependencies:
# The flutter tools depend on very specific internal implementation # The flutter tools depend on very specific internal implementation
# details of the 'test' package, which change between versions, so # details of the 'test' package, which change between versions, so
# here we pin it precisely to avoid version skew across our packages. # here we pin it precisely to avoid version skew across our packages.
test: 0.12.15+9 test: 0.12.18+2
flutter: flutter:
sdk: flutter sdk: flutter
...@@ -34,7 +34,7 @@ dependencies: ...@@ -34,7 +34,7 @@ dependencies:
# We depend on very specific internal implementation details of the # We depend on very specific internal implementation details of the
# 'test' package, which change between versions, so here we pin it # 'test' package, which change between versions, so here we pin it
# precisely. # precisely.
test: 0.12.15+9 test: 0.12.18+2
# Version from the vended Dart SDK as defined in `dependency_overrides`. # Version from the vended Dart SDK as defined in `dependency_overrides`.
analyzer: any analyzer: any
......
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
testUsingContext('returns 1 when app fails to run', () async { testUsingContext('returns 1 when app fails to run', () async {
withMockDevice(); 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 testApp = fs.path.join(cwd.path, 'test_driver', 'e2e.dart');
String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.dart'); String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.dart');
...@@ -157,14 +157,14 @@ void main() { ...@@ -157,14 +157,14 @@ void main() {
String testApp = fs.path.join(cwd.path, 'test', 'e2e.dart'); String testApp = fs.path.join(cwd.path, 'test', 'e2e.dart');
String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.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(); return new LaunchResult.succeeded();
}); });
testRunner = expectAsync((List<String> testArgs, String observatoryUri) async { testRunner = expectAsync2((List<String> testArgs, String observatoryUri) async {
expect(testArgs, <String>[testFile]); expect(testArgs, <String>[testFile]);
return null; return null;
}); });
appStopper = expectAsync((DriveCommand command) async { appStopper = expectAsync1((DriveCommand command) async {
return true; return true;
}); });
...@@ -188,13 +188,13 @@ void main() { ...@@ -188,13 +188,13 @@ void main() {
String testApp = fs.path.join(cwd.path, 'test', 'e2e.dart'); String testApp = fs.path.join(cwd.path, 'test', 'e2e.dart');
String testFile = fs.path.join(cwd.path, 'test_driver', 'e2e_test.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(); return new LaunchResult.succeeded();
}); });
testRunner = (List<String> testArgs, String observatoryUri) async { testRunner = (List<String> testArgs, String observatoryUri) async {
throwToolExit(null, exitCode: 123); throwToolExit(null, exitCode: 123);
}; };
appStopper = expectAsync((DriveCommand command) async { appStopper = expectAsync1((DriveCommand command) async {
return true; return true;
}); });
......
...@@ -37,8 +37,8 @@ void updateFileModificationTime(String path, ...@@ -37,8 +37,8 @@ void updateFileModificationTime(String path,
/// Matcher for functions that throw ToolExit. /// Matcher for functions that throw ToolExit.
Matcher throwsToolExit([int exitCode]) { Matcher throwsToolExit([int exitCode]) {
return exitCode == null return exitCode == null
? const Throws(isToolExit) ? throwsA(isToolExit)
: new Throws(allOf(isToolExit, (ToolExit e) => e.exitCode == exitCode)); : throwsA(allOf(isToolExit, (ToolExit e) => e.exitCode == exitCode));
} }
/// Matcher for [ToolExit]s. /// Matcher for [ToolExit]s.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment