Skip to content

docs: ScreenDiff's changed_rows and style_changes get runnable examples - #560

Merged
vyncint merged 1 commit into
mainfrom
docs/screendiff-doctests
Oct 6, 2026
Merged

vyncint merged 1 commit into
mainfrom
docs/screendiff-doctests

Conversation

@vyncint

@vyncint vyncint commented Oct 6, 2026

Copy link
Copy Markdown
Owner

changed_rows gave its example as code inside a sentence, which nothing
compiles, and style_changes had none. Both now share one doctest scene,
the one the prose describes: a reverse-video highlight moving from row 1
to row 2 of a parsed three-row menu. changed_rows asserts [1, 2], and
style_changes asserts the two (row, before, after) tuples, (1, "0-5 reverse", "(none)") and (2, "(none)", "0-5 reverse").

The screens come from Screen::parse, so neither doctest needs a terminal
and both run on every platform. Each fails when its expected value is
changed, checked by editing it; they pass with default, no default and all
features, and rustdoc is clean with -D warnings.

Closes #542

`changed_rows` gave its example as code inside a sentence, which nothing
compiles, and `style_changes` had none. Both now share one doctest scene,
the one the prose describes: a reverse-video highlight moving from row 1
to row 2 of a parsed three-row menu. `changed_rows` asserts `[1, 2]`, and
`style_changes` asserts the two `(row, before, after)` tuples, `(1,
"0-5 reverse", "(none)")` and `(2, "(none)", "0-5 reverse")`.

The screens come from `Screen::parse`, so neither doctest needs a terminal
and both run on every platform. Each fails when its expected value is
changed, checked by editing it; they pass with default, no default and all
features, and rustdoc is clean with `-D warnings`.

Closes #542

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
@vyncint
vyncint merged commit a603aa9 into main Oct 6, 2026
16 checks passed
@vyncint
vyncint deleted the docs/screendiff-doctests branch October 6, 2026 23:42
@vyncint vyncint mentioned this pull request Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: turn ScreenDiff::changed_rows's inline example into a doctest, and give style_changes one

1 participant