Commit a002e720 authored by Phil Quitslund's avatar Phil Quitslund Committed by GitHub

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.
parent 8c043d06
...@@ -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.18+2 test: 0.12.20
...@@ -20,6 +20,6 @@ dependencies: ...@@ -20,6 +20,6 @@ dependencies:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
test: 0.12.18+2 test: 0.12.20
mockito: ^1.0.0 mockito: ^1.0.0
quiver: ^0.24.0 quiver: ^0.24.0
...@@ -13,19 +13,22 @@ ...@@ -13,19 +13,22 @@
/// with the precise file and line number that called that function. /// with the precise file and line number that called that function.
int reportExpectCall(StackTrace stack, StringBuffer information) { int reportExpectCall(StackTrace stack, StringBuffer information) {
final RegExp line0 = new RegExp(r'^#0 +fail \(.+\)$'); 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 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<String> stackLines = stack.toString().split('\n'); final List<String> stackLines = stack.toString().split('\n');
if (line0.firstMatch(stackLines[0]) != null && if (line0.firstMatch(stackLines[0]) != null &&
line1.firstMatch(stackLines[1]) != null && line1.firstMatch(stackLines[1]) != null &&
line2.firstMatch(stackLines[2]) != null) { line2.firstMatch(stackLines[2]) != null &&
Match expectMatch = line3.firstMatch(stackLines[3]); line3.firstMatch(stackLines[3]) != null
) {
Match expectMatch = line4.firstMatch(stackLines[4]);
assert(expectMatch != null); assert(expectMatch != null);
assert(expectMatch.groupCount == 2); assert(expectMatch.groupCount == 2);
information.writeln('This was caught by the test expectation on the following line:'); information.writeln('This was caught by the test expectation on the following line:');
information.writeln(' ${expectMatch.group(1)} line ${expectMatch.group(2)}'); information.writeln(' ${expectMatch.group(1)} line ${expectMatch.group(2)}');
return 3; return 4;
} }
return 0; return 0;
} }
\ No newline at end of file
...@@ -119,10 +119,9 @@ Future<Null> benchmarkWidgets(WidgetTesterCallback callback) { ...@@ -119,10 +119,9 @@ Future<Null> benchmarkWidgets(WidgetTesterCallback callback) {
/// that have not yet resolved. /// that have not yet resolved.
void expect(dynamic actual, dynamic matcher, { void expect(dynamic actual, dynamic matcher, {
String reason, String reason,
bool verbose: false,
}) { }) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
test_package.expect(actual, matcher, reason: reason, verbose: verbose); test_package.expect(actual, matcher, reason: reason);
} }
/// Assert that `actual` matches `matcher`. /// Assert that `actual` matches `matcher`.
...@@ -136,9 +135,8 @@ void expect(dynamic actual, dynamic matcher, { ...@@ -136,9 +135,8 @@ void expect(dynamic actual, dynamic matcher, {
/// that asynchronous APIs are not being called. /// that asynchronous APIs are not being called.
void expectSync(dynamic actual, dynamic matcher, { void expectSync(dynamic actual, dynamic matcher, {
String reason, 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. /// 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.18+2 test: 0.12.20
flutter: flutter:
sdk: flutter sdk: flutter
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
throw 'unexpectedly did not throw'; throw 'unexpectedly did not throw';
} catch (e, stack) { } catch (e, stack) {
StringBuffer information = new StringBuffer(); StringBuffer information = new StringBuffer();
expect(reportExpectCall(stack, information), 3); expect(reportExpectCall(stack, information), 4);
List<String> lines = information.toString().split('\n'); List<String> lines = information.toString().split('\n');
expect(lines[0], 'This was caught by the test expectation on the following line:'); 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]+$')); expect(lines[1], matches(r'^ .*stack_manipulation_test.dart line [0-9]+$'));
......
...@@ -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.18+2 test: 0.12.20
# 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
......
...@@ -82,7 +82,7 @@ Future<Null> _testFile(String testName, int wantedExitCode, String workingDirect ...@@ -82,7 +82,7 @@ Future<Null> _testFile(String testName, int wantedExitCode, String workingDirect
expect(haveSeenStdErrMarker, isFalse); expect(haveSeenStdErrMarker, isFalse);
haveSeenStdErrMarker = true; 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; expectationLineNumber += 1;
outputLineNumber += 1; outputLineNumber += 1;
} }
......
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