Roundtrip tests, convenience function tests, bug fixes, and documentation updates. #3

Merged
dan merged 2 commits from tests into main 2025-11-30 21:37:58 +01:00
Owner

This larger PR adds in a bunch of testing code, and updates the existing documentation.

Specifically, it adds:

  • Roundtrip tests for serializing and deserializing ComicInfo structs. The implementation of those don't use quickcheck, but rather explicitly written generate_XXX functions in mod tests.
  • Generated tests for the "convenience" functions (e.g. add_many_writers). These are made with a macro, similar to how the functions themselves are made with a macro.
  • Relevant documentation for the above 2 points

It changes:

  • The "set-esque" fields on ComicInfo structs are now Option<IndexSet<String>> so deserializing them is easier.

It fixes:

  • Bugs in (de-)serialization logic.
  • Bugs in percent-encoding logic (for the Web field).
This larger PR adds in a bunch of testing code, and updates the existing documentation. Specifically, it adds: - Roundtrip tests for serializing and deserializing `ComicInfo` structs. The implementation of those don't use `quickcheck`, but rather explicitly written `generate_XXX` functions in `mod tests`. - Generated tests for the "convenience" functions (e.g. `add_many_writers`). These are made with a macro, similar to how the functions themselves are made with a macro. - Relevant documentation for the above 2 points It changes: - The "set-esque" fields on `ComicInfo` structs are now `Option<IndexSet<String>>` so deserializing them is easier. It fixes: - Bugs in (de-)serialization logic. - Bugs in percent-encoding logic (for the `Web` field).
This large commit adds roundtrip property tests for ComicInfo structs.
It also includes fixes for issues found by running said roundtrip tests.
This ranges from type changes in ComicInfo fields to fixes in custom
(de-)serialization code.

Besides those tests, documentation has been slightly updated. No longer
do we include the README in `lib.rs`, instead providing proper examples
that can be run.

Next task: add tests for the convenience functions.
test+fix: Generate tests for macro-generated convenience functions
All checks were successful
Build / build (push) Successful in 37s
435eb84cab
This commit adds a macro in `utils.rs` used to generate (many) tests for
the convience functions added by the other macro that lives in the same
file. It fixes the existing macro to not doubly-encode Web fields, and
generally simplifies them by removing unwanted inner matches on separators.
This only got discovered thanks to the newly generated tests!

With this commit, a new release can be made.
dan merged commit 5203498dc0 into main 2025-11-30 21:37:58 +01:00
dan deleted branch tests 2025-11-30 21:37:58 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dan/comicinfo!3
No description provided.