Add property-based tests for complex converters and utility functions#97
Merged
SeanTAllen merged 1 commit intomainfrom Mar 3, 2026
Merged
Add property-based tests for complex converters and utility functions#97SeanTAllen merged 1 commit intomainfrom
SeanTAllen merged 1 commit intomainfrom
Conversation
Items 4 and 5 from the testing plan (Discussion #93). Tests the two most complex JSON converters (RepositoryJsonConverter with 69 required fields and GistJsonConverter with object iteration + defaults) plus direct tests for JsonNavUtil.string_or_none and JsonTypeString. 11 new test classes, 4 new builder helpers. Covers preserves-values, missing-field, and absent-optional patterns for both converters, plus property and example tests for the utility functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Items 4 and 5 from the testing plan (Discussion #93). The first three PRs (#94-#96) established patterns for simple, nullable-field, and nested-object converters. This covers the two remaining converters and the utility functions they depend on.
The Repository converter has 69 required fields including 4 nullable strings, 4 optional nested values, and 35 template URLs. The test uses a 4-bit mask to exercise all 16 null/non-null combinations of the nullable fields, and a 69-entry field name array with
removefor the missing-field test (theif skip_idx != Npattern from simpler tests would be impractical at this scale).The Gist converter is structurally different from every other converter — it iterates a JSON object's key-value pairs instead of an array. The test verifies both the iteration mechanics (file count, key name, nested GistFile field) and the
comments_enableddefault (truewhen absent, explicitfalsewhen present).The utility tests cover
JsonNavUtil.string_or_none(string path, null path, error on wrong type, error on missing key) andJsonTypeString(all 8 match arms plus an I64 property test).11 new test classes, 4 new builder helpers.
Design: #93