Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@cbracken
Copy link
Member

@cbracken cbracken commented Aug 29, 2020

Description

This extracts a Dart test utilities library, containing expectAssertion and expectArgumentError functions that simplify running tests that test assertions across debug, profile, and release configurations.

This change also restricts Dart unit tests to testing files whose filename matches *_test.dart under flutter/testing/dart; previously any file in that directory was run, but all files matched the above pattern.

@cbracken cbracken requested review from Hixie and chinmaygarde August 29, 2020 05:42
@auto-assign auto-assign bot requested a review from gaaclarke August 29, 2020 05:43
@cbracken
Copy link
Member Author

cbracken commented Aug 29, 2020

For what it's worth, I think these implementations could be simplified and I'll probably send a cleanup PR once I've landed the lerpDouble work in #20871, but the goal here is just to extract what's there.

This extracts a Dart test utilities library, containing
`expectAssertion` and `expectArgumentError` functions that simplify
running tests that test assertions across debug, profile, and release
configurations.

This change also restricts Dart unit tests to testing files whose
filename matches `*_test.dart` under `flutter/testing/dart`; previously
any file in that directory was run, but all files matched the above
pattern.
Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

/// specified callback throws an [AssertionError]. When asserts are not
/// enabled, such as when running using a release-mode VM with default
/// settings, this acts as a no-op.
void expectAssertion(Function callback) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random unsolicited note (since you asked :D) why not give it a class and a function to just expectThrows instead? Something like https://www.codota.com/code/java/methods/org.testng.Assert/expectThrows

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Will land this as-is so I can use it for the lerp tests, but as I say, planning to do a cleanup so will take a look!

@cbracken cbracken merged commit 14ac65c into flutter:master Aug 30, 2020
@cbracken cbracken deleted the extract-test-utils branch August 30, 2020 18:07
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants