This issue was originally reported on flutter/flutter as flutter/flutter#94170
Steps to Reproduce
- Use this test
Details
pubspec.yaml as
dev_dependencies:
flutter_test:
sdk: flutter
main(){
test("given a async closure that dosnt throw, then it shouldnt throw", () async {
await expectLater(() => Future.value("this dosnt throw and just returns"), isNot(throwsA(anything)));
});
test("samezys just with expect", () {
expect(() => Future.value("same"), isNot(throwsA(anything)));
});
test("given sync funcs, the test should detect throwing", () {
expect(() => "test", isNot(throwsA(anything)));
expect(() => throw Error(), throwsA(anything));
});
test("given a throwing future, then the closure should throw", (){
expect(() => Future.error(Error()), throwsA(anything));
});
}
- Execute
flutter test on the code appended.
- I would expect that both tests should satisfy this criterion.
What actually happens
Expected results:
I expect that all test cases finish without error.
Actual results:
Both async isNot tests fail with equivalent error messages.
Expected: not throws anything
Actual: <Closure: () => Future<String>>
package:test_api expectLater
package:flutter_test/src/widget_tester.dart 498:10 expectLater
test\example.dart 60:15 main.<fn>.<fn>.<fn>
test\example.dart 58:41 main.<fn>.<fn>.<fn>
flutter doctor -v
```
PS C:\Users\user\Documents\Developer\medlog> flutter doctor -v
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.22000.282], locale en-US)
• Flutter version 2.5.3 at C:\Users\user\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (6 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\user\AppData\Local\Android\Sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_SDK_ROOT = C:\Users\user\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2020.3
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.62.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.28.0
[√] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
• No issues found!
</details>
<!--
Consider also attaching screenshots and/or videos to better
illustrate the issue.
You can upload them directly on GitHub.
Beware that video file size is limited to 10MB.
-->
This issue was originally reported on flutter/flutter as flutter/flutter#94170
Steps to Reproduce
Details
pubspec.yaml as
flutter teston the code appended.What actually happens
Expected results:
I expect that all test cases finish without error.
Actual results:
Both async isNot tests fail with equivalent error messages.
flutter doctor -v
``` PS C:\Users\user\Documents\Developer\medlog> flutter doctor -v [√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.22000.282], locale en-US) • Flutter version 2.5.3 at C:\Users\user\Documents\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (6 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\user\AppData\Local\Android\Sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_SDK_ROOT = C:\Users\user\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2020.3
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.62.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.28.0
[√] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
• No issues found!