From a002e72022484050317cd4e493f26e38c3a3db74 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 23 Feb 2017 15:08:25 -0800 Subject: [PATCH] Bump to test `0.12.20`. (#8349) * Bump to test `0.12.20`. Some test `0.12.20` highlights: * introduces `expectLater()` that returns a `Future` that completes when the matcher has finished running * deprecates the `verbose` parameter to `expect()` and the `formatFailure()` (to be removed in `0.13.0`) Otherwise: * to keep up w/ the deprecation of `verbose`, removes `widget_tester` API to pass `verbose` flag (alternatively we could suppress the warning for now) * Update stack manipulation. * Fix framecount. --- dev/devicelab/pubspec.yaml | 2 +- packages/flutter_driver/pubspec.yaml | 2 +- .../flutter_test/lib/src/stack_manipulation.dart | 13 ++++++++----- packages/flutter_test/lib/src/widget_tester.dart | 6 ++---- packages/flutter_test/pubspec.yaml | 2 +- .../flutter_test/test/stack_manipulation_test.dart | 2 +- packages/flutter_tools/pubspec.yaml | 2 +- packages/flutter_tools/test/test_test.dart | 2 +- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dev/devicelab/pubspec.yaml b/dev/devicelab/pubspec.yaml index a0673dc420..641cecf135 100644 --- a/dev/devicelab/pubspec.yaml +++ b/dev/devicelab/pubspec.yaml @@ -16,4 +16,4 @@ dependencies: dev_dependencies: # See packages/flutter_test/pubspec.yaml for why we're pinning this version. - test: 0.12.18+2 + test: 0.12.20 diff --git a/packages/flutter_driver/pubspec.yaml b/packages/flutter_driver/pubspec.yaml index 0749229183..a6d098834f 100644 --- a/packages/flutter_driver/pubspec.yaml +++ b/packages/flutter_driver/pubspec.yaml @@ -20,6 +20,6 @@ dependencies: sdk: flutter dev_dependencies: - test: 0.12.18+2 + test: 0.12.20 mockito: ^1.0.0 quiver: ^0.24.0 diff --git a/packages/flutter_test/lib/src/stack_manipulation.dart b/packages/flutter_test/lib/src/stack_manipulation.dart index 07bd078d82..d23d8d6ff8 100644 --- a/packages/flutter_test/lib/src/stack_manipulation.dart +++ b/packages/flutter_test/lib/src/stack_manipulation.dart @@ -13,19 +13,22 @@ /// with the precise file and line number that called that function. int reportExpectCall(StackTrace stack, StringBuffer information) { final RegExp line0 = new RegExp(r'^#0 +fail \(.+\)$'); - final RegExp line1 = new RegExp(r'^#1 +expect \(.+\)$'); + final RegExp line1 = new RegExp(r'^#1 +_expect \(.+\)$'); final RegExp line2 = new RegExp(r'^#2 +expect \(.+\)$'); - final RegExp line3 = new RegExp(r'^#3 +[^(]+ \((.+?):([0-9]+)(?::[0-9]+)?\)$'); + final RegExp line3 = new RegExp(r'^#3 +expect \(.+\)$'); + final RegExp line4 = new RegExp(r'^#4 +[^(]+ \((.+?):([0-9]+)(?::[0-9]+)?\)$'); final List stackLines = stack.toString().split('\n'); if (line0.firstMatch(stackLines[0]) != null && line1.firstMatch(stackLines[1]) != null && - line2.firstMatch(stackLines[2]) != null) { - Match expectMatch = line3.firstMatch(stackLines[3]); + line2.firstMatch(stackLines[2]) != null && + line3.firstMatch(stackLines[3]) != null + ) { + Match expectMatch = line4.firstMatch(stackLines[4]); assert(expectMatch != null); assert(expectMatch.groupCount == 2); information.writeln('This was caught by the test expectation on the following line:'); information.writeln(' ${expectMatch.group(1)} line ${expectMatch.group(2)}'); - return 3; + return 4; } return 0; } \ No newline at end of file diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index 1c7a823934..62ae487d38 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -119,10 +119,9 @@ Future benchmarkWidgets(WidgetTesterCallback callback) { /// that have not yet resolved. void expect(dynamic actual, dynamic matcher, { String reason, - bool verbose: false, }) { TestAsyncUtils.guardSync(); - test_package.expect(actual, matcher, reason: reason, verbose: verbose); + test_package.expect(actual, matcher, reason: reason); } /// Assert that `actual` matches `matcher`. @@ -136,9 +135,8 @@ void expect(dynamic actual, dynamic matcher, { /// that asynchronous APIs are not being called. void expectSync(dynamic actual, dynamic matcher, { String reason, - bool verbose: false, }) { - test_package.expect(actual, matcher, reason: reason, verbose: verbose); + test_package.expect(actual, matcher, reason: reason); } /// 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 4d5e7e1ae8..ed8f72f04b 100644 --- a/packages/flutter_test/pubspec.yaml +++ b/packages/flutter_test/pubspec.yaml @@ -5,7 +5,7 @@ dependencies: # 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.18+2 + test: 0.12.20 flutter: sdk: flutter diff --git a/packages/flutter_test/test/stack_manipulation_test.dart b/packages/flutter_test/test/stack_manipulation_test.dart index 7586cbfcff..51a9cc68c8 100644 --- a/packages/flutter_test/test/stack_manipulation_test.dart +++ b/packages/flutter_test/test/stack_manipulation_test.dart @@ -11,7 +11,7 @@ void main() { throw 'unexpectedly did not throw'; } catch (e, stack) { StringBuffer information = new StringBuffer(); - expect(reportExpectCall(stack, information), 3); + expect(reportExpectCall(stack, information), 4); List lines = information.toString().split('\n'); expect(lines[0], 'This was caught by the test expectation on the following line:'); expect(lines[1], matches(r'^ .*stack_manipulation_test.dart line [0-9]+$')); diff --git a/packages/flutter_tools/pubspec.yaml b/packages/flutter_tools/pubspec.yaml index ed4123b60f..5db4ea9d3d 100644 --- a/packages/flutter_tools/pubspec.yaml +++ b/packages/flutter_tools/pubspec.yaml @@ -34,7 +34,7 @@ dependencies: # 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.18+2 + test: 0.12.20 # Version from the vended Dart SDK as defined in `dependency_overrides`. analyzer: any diff --git a/packages/flutter_tools/test/test_test.dart b/packages/flutter_tools/test/test_test.dart index 3e27aebfd9..262ab00aa5 100644 --- a/packages/flutter_tools/test/test_test.dart +++ b/packages/flutter_tools/test/test_test.dart @@ -82,7 +82,7 @@ Future _testFile(String testName, int wantedExitCode, String workingDirect expect(haveSeenStdErrMarker, isFalse); haveSeenStdErrMarker = true; } - expect(outputLine, matches(expectationLine), verbose: true, reason: 'Full output:\n- - - -----8<----- - - -\n${output.join("\n")}\n- - - -----8<----- - - -'); + expect(outputLine, matches(expectationLine), reason: 'Full output:\n- - - -----8<----- - - -\n${output.join("\n")}\n- - - -----8<----- - - -'); expectationLineNumber += 1; outputLineNumber += 1; }