Skip to content

test: adopt rstest for parameterized tests - #75

Merged
velocitysystems merged 2 commits into
silvermine:masterfrom
remdalm:feat/rstest
Oct 25, 2026
Merged

velocitysystems merged 2 commits into
silvermine:masterfrom
remdalm:feat/rstest

Conversation

@remdalm

@remdalm remdalm commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

test_regular_abort_for_db_only_matching_db_key and
test_regular_abort_for_db_does_not_match_colon_prefix_alias ended by calling
abort_for_db for the other database. abort_for_db returns Ok(()) when nothing matches,
so neither test checked that the other transaction was still tracked.

Both tests now keep each task's AbortHandle. They assert that the matching task
finished and the other did not, then that aborting the other database finishes it.
Making abort_for_db match every transaction, or match by prefix, now fails them.
@remdalm
remdalm requested a review from a team October 24, 2026 09:47
@remdalm
remdalm marked this pull request as draft October 24, 2026 09:48
@remdalm
remdalm marked this pull request as ready for review October 24, 2026 10:04
Comment thread crates/sqlx-sqlite-toolkit/tests/transaction_state_tests.rs
Comment thread crates/sqlx-sqlite-conn-mgr/src/attached.rs
@remdalm
remdalm force-pushed the feat/rstest branch 2 times, most recently from f12c6d8 to 327df29 Compare October 24, 2026 16:37
@remdalm
remdalm requested a review from jjhafer October 24, 2026 16:38
Comment thread Cargo.toml Outdated
Comment thread crates/sqlx-sqlite-conn-mgr/Cargo.toml Outdated
A test that loops over inputs, or puts one assert per input in one function, stops at
the first failing input, and cargo test cannot run one input on its own. rstest
generates one test per #[case], so a run reports every failing input and each one can
be run by name.

The scope follows tauri-plugin-connectivity's adoption of rstest (c5d624d), with a
stricter rule for merging separate tests:

- Every test that checked several inputs in one function is now a table with one
  named case per input.
- Separate tests are merged only when each case is another example of the same
  guarantee. A comment saying why an input is interesting is fine. A case that needs
  different assertions, a branch, or a comment arguing a different guarantee stays
  its own test.
- Scenario tests stay plain: setup loops, ordered or stateful steps, races, polling,
  and tests that differ in which operation they run.

Every input keeps its value. The storage-class round trip now reads each value
through quote(), which pins the value and its storage class in one string and
replaces the separate typeof probe. Some rejections now assert the exact error variant
or code instead of is_err(). test_reserved_schema_names_rejected loses its closing
check that nothing stayed attached: every rejection happens in validation, before
any ATTACH, so that check could not fail.

The workspace goes from 358 test functions to 416 generated tests, 173 of them cases
in 42 tables. CHANGELOG.md names the readable-notification test by its new name.

rstest 0.28.0 is a dev-dependency of all four crates with default features off. Its
crate-name feature changes feature resolution for toml crates that tauri's build
shares, so a warm workspace build would rebuild tauri. Cargo.lock adds rstest,
rstest_macros and relative-path. It also moves some Windows-only edges from
windows-sys 0.60 to 0.61, which adding any new package does here. Nothing else in the
normal dependency graph changes.
@velocitysystems
velocitysystems merged commit ef09edf into silvermine:master Oct 25, 2026
1 check passed
@remdalm
remdalm deleted the feat/rstest branch October 25, 2026 21:34
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.

3 participants