commit | 92eed6c4b6c0d008796fe7bfdb51601de0f112b6 | [log] [tgz] |
---|---|---|
author | Lasse R.H. Nielsen <lrn@google.com> | Mon Jan 27 14:05:31 2025 +0100 |
committer | GitHub <noreply@github.com> | Mon Jan 27 14:05:31 2025 +0100 |
tree | ab47a5340729ceceedf1350c5f5307539d455d80 | |
parent | ad04f1720d1a39f00f01ebfe90f7a09dd2060b67 [diff] | |
parent | 1f292db8a45a734b72e0626540e24ae687cb0edb [diff] |
Make zone handlers call zone.run to run callbacks. (#2451) The platform library `Zone` implementation will change to not use `bindCallbackGuarded` in the `Timer` constructors and top-level `scheduleMicrotask` function. Instead it only calls `registerCallback`, and then the `Zone.create{,Periodic}Timer` and `Zone.scheduleMicrotask` are in charge of using `Zone.runGuarded` on the callback when timer/microtask event happens. This ensures that a surrounding zone's `registerCallback` can't make the callback throw in a way that is outside of the `runGuarded` call. Also makes periodic timers that are delayed past multiple tick points, update their `tick` count by more than one instead of running multiple times, like timers should. Adds testing of using the `FakeAsync`'s `Zone` functions directly, and embedding it in another zone to check that it does run using `Zone.run`. Adds testing of periodic timers incrementing `tick` by more than one.
Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api
and package:test_core
are implementation details and generally not user-facing.
package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher
and features a literate API.
Package | Description | Issues | Version |
---|---|---|---|
checks | A framework for checking values against expectations and building custom expectations. | ||
fake_async | Fake asynchronous events such as timers and microtasks for deterministic testing. | ||
matcher | Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. | ||
test | A full featured library for writing and running Dart tests across platforms. | ||
test_api | The user facing API for structuring Dart tests and checking expectations. | ||
test_core | A basic library for writing tests and running them on the VM. | ||
test_descriptor | An API for defining and verifying files and directory structures. | ||
test_process | Test processes: starting; validating stdout and stderr; checking exit code. |