Martin Pool
b9cf5886e4
Run doctests in CI and fix up existing doctests ( #37851 )
...
Follows on from
https://github.com/zed-industries/zed/pull/37716#pullrequestreview-3195695110
by @SomeoneToIgnore
After this the doctests will be run in CI to check that the examples are
still accurate.
Note that doctests aren't run by Nextest: you can run them locally with
`cargo test --doc`.
Summary:
* Run tests from CI
* Loosen an exact float comparison to match approximately (otherwise it
fails)
* Fixed one actual bug in the tests for `dilate` where the test code
assumed that `dilate` mutates `self` rather than returning a new object
* Add some `must_use` on some functions that seemed at risk of similar
bugs, following the Rust stdlib style to add it where ignoring the
result is almost certainly a bug.
* Fix some cases where the doc examples seem to have gone out of date
with the code
* Add imports to doctests that need them
* Add some dev-dependencies to make the tests build
* Fix the `key_dispatch` module docstring, which was accidentally
attached to objects within that module
* Skip some doctest examples that seem like they need an async
environment or that just looked hard to get running
AI usage: I asked Claude to do some of the repetitive tests. I checked
the output and fixed up some things that seemed to not be in the right
spirit of the test, or too longwinded.
I think we could reasonably run the tests on only Linux to save CI
CPU-seconds and latency, but I haven't done that yet, partly because of
how it's implemented in the action.
Release Notes:
- N/A
2025-09-12 23:24:04 +03:00
..
2025-09-12 14:55:25 -04:00
2025-08-25 16:04:44 -06:00
2025-09-04 17:14:53 +02:00
2025-09-08 11:22:36 +00:00
2025-09-12 18:07:59 +02:00
2025-09-12 15:22:51 +00:00
2025-09-12 15:22:51 +00:00
2025-09-12 18:07:59 +02:00
2025-09-12 14:55:25 -04:00
2025-09-10 20:11:07 +00:00
2025-09-04 06:02:13 +02:00
2025-08-19 21:26:17 +02:00
2025-09-04 17:14:53 +02:00
2025-08-27 23:24:19 +00:00
2025-09-10 18:21:51 +00:00
2025-09-11 22:18:42 -04:00
2025-09-11 22:18:42 -04:00
2025-09-12 13:56:48 +00:00
2025-09-11 22:29:06 +00:00
2025-08-29 17:18:52 -07:00
2025-09-08 21:53:17 -06:00
2025-08-29 18:13:06 -04:00
2025-08-27 23:24:19 +00:00
2025-09-04 17:14:53 +02:00
2025-09-10 22:48:33 +02:00
2025-09-08 21:53:17 -06:00
2025-09-03 03:49:04 +00:00
2025-09-11 21:00:03 -04:00
2025-08-22 11:45:47 -04:00
2025-09-10 20:11:07 +00:00
2025-09-10 20:11:07 +00:00
2025-09-12 14:45:38 -04:00
2025-09-10 23:06:09 +05:30
2025-08-26 00:27:52 +00:00
2025-09-05 14:22:32 +02:00
2025-09-08 12:23:33 +03:00
2025-09-03 00:03:56 +00:00
2025-09-09 13:28:26 -06:00
2025-09-11 11:06:04 -07:00
2025-08-19 21:26:17 +02:00
2025-09-09 18:48:22 +00:00
2025-08-28 07:53:32 +00:00
2025-09-03 22:10:14 +00:00
2025-08-20 12:20:13 +02:00
2025-09-10 23:06:09 +05:30
2025-09-04 05:51:48 +00:00
2025-09-08 09:14:24 -06:00
2025-08-27 03:24:50 +08:00
2025-08-22 11:45:47 -04:00
2025-09-12 14:22:35 -03:00
2025-09-11 16:58:11 +02:00
2025-09-11 19:00:51 +00:00
2025-08-19 20:33:44 +00:00
2025-09-11 13:56:06 -07:00
2025-09-12 19:22:24 +02:00
2025-09-10 23:06:09 +05:30
2025-09-12 18:07:59 +02:00
2025-08-21 19:59:42 -04:00
2025-09-12 14:55:25 -04:00
2025-09-12 14:55:25 -04:00
2025-09-12 14:45:38 -04:00
2025-08-19 13:27:24 +00:00
2025-09-12 14:45:38 -04:00
2025-09-04 15:19:02 -04:00
2025-09-12 14:45:38 -04:00
2025-09-12 15:55:19 -04:00
2025-08-28 12:00:44 +00:00
2025-09-12 23:24:04 +03:00
2025-08-29 16:56:10 -04:00
2025-08-21 17:19:57 +00:00
2025-08-19 13:27:24 +00:00
2025-08-20 12:20:13 +02:00
2025-08-28 07:53:32 +00:00
2025-09-04 15:19:02 -04:00
2025-09-02 20:18:15 -03:00
2025-09-09 20:56:08 +02:00
2025-08-19 20:33:44 +00:00
2025-09-10 23:06:09 +05:30
2025-09-04 15:19:02 -04:00
2025-09-10 16:57:05 +00:00
2025-09-12 09:37:45 +00:00
2025-09-12 09:37:45 +00:00
2025-09-10 20:11:07 +00:00
2025-09-12 11:17:55 +02:00
2025-09-08 18:51:13 -03:00
2025-09-10 23:06:09 +05:30
2025-09-12 14:22:35 -03:00
2025-09-12 12:02:39 +00:00
2025-09-10 23:06:09 +05:30
2025-09-11 14:45:42 +00:00
2025-09-03 01:22:57 +02:00
2025-09-12 09:37:45 +00:00
2025-09-11 19:00:51 +00:00
2025-09-10 05:34:42 +00:00
2025-08-20 12:20:13 +02:00
2025-09-03 01:22:57 +02:00
2025-09-11 16:58:11 +02:00
2025-08-19 20:33:44 +00:00
2025-09-08 21:53:17 -06:00
2025-09-09 20:08:05 +00:00
2025-09-10 23:06:09 +05:30
2025-09-08 22:01:55 +02:00
2025-09-12 11:17:55 +02:00
2025-09-09 13:26:35 -06:00
2025-09-12 14:55:25 -04:00
2025-08-20 12:20:13 +02:00
2025-09-11 21:00:03 -04:00
2025-09-10 15:38:19 +00:00
2025-08-19 21:26:17 +02:00
2025-09-12 15:55:19 -04:00
2025-09-12 14:55:25 -04:00
2025-09-10 23:06:09 +05:30
2025-08-20 12:20:13 +02:00
2025-09-12 23:24:04 +03:00
2025-09-10 15:38:19 +00:00
2025-09-12 23:24:04 +03:00
2025-09-03 14:24:32 -07:00
2025-09-11 19:00:51 +00:00
2025-09-12 23:24:04 +03:00
2025-09-03 00:52:04 +00:00
2025-08-19 13:27:24 +00:00
2025-09-10 16:13:41 -04:00
2025-09-08 21:53:17 -06:00
2025-09-10 15:38:19 +00:00
2025-09-10 22:02:23 +00:00
2025-09-11 14:55:14 +02:00
2025-08-19 13:27:24 +00:00
2025-09-10 18:02:08 -04:00
2025-09-10 23:06:09 +05:30
2025-09-12 15:03:24 -04:00
2025-09-12 23:24:04 +03:00
2025-08-19 21:26:17 +02:00
2025-08-19 21:26:17 +02:00
2025-09-10 23:06:09 +05:30
2025-09-06 01:09:50 +00:00
2025-08-20 12:20:13 +02:00
2025-08-19 20:33:44 +00:00
2025-09-04 17:14:53 +02:00
2025-09-04 17:14:53 +02:00
2025-08-29 16:17:22 -04:00
2025-08-19 21:26:17 +02:00
2025-09-12 18:08:21 +00:00
2025-08-21 19:59:42 -04:00
2025-09-10 23:06:09 +05:30
2025-09-12 12:02:39 +00:00
2025-09-10 23:06:09 +05:30
2025-09-12 23:24:04 +03:00
2025-09-12 23:24:04 +03:00
2025-09-12 03:18:28 +00:00
2025-09-11 16:58:11 +02:00
2025-09-12 14:55:25 -04:00
2025-08-20 12:20:13 +02:00
2025-09-10 23:06:09 +05:30
2025-09-10 20:11:07 +00:00
2025-09-10 23:06:09 +05:30
2025-09-12 23:24:04 +03:00
2025-09-10 15:38:19 +00:00
2025-09-12 23:24:04 +03:00
2025-09-11 21:00:03 -04:00
2025-09-12 17:47:07 +02:00
2025-09-12 15:55:19 -04:00
2025-08-25 14:28:11 -04:00
2025-08-20 12:20:13 +02:00
2025-08-19 20:33:44 +00:00
2025-09-12 03:18:28 +00:00
2025-09-11 21:00:03 -04:00
2025-08-26 21:08:45 +00:00
2025-09-12 14:45:38 -04:00
2025-09-12 14:45:38 -04:00
2025-09-03 22:10:14 +00:00
2025-09-11 19:57:24 +00:00
2025-09-11 19:00:51 +00:00
2025-09-06 00:27:14 +02:00
2025-09-04 15:19:02 -04:00