Skip to content

Add property-based tests for complex converters and utility functions#97

Merged
SeanTAllen merged 1 commit intomainfrom
sean/complex-converter-tests
Mar 3, 2026
Merged

Add property-based tests for complex converters and utility functions#97
SeanTAllen merged 1 commit intomainfrom
sean/complex-converter-tests

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

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 remove for the missing-field test (the if skip_idx != N pattern 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_enabled default (true when absent, explicit false when present).

The utility tests cover JsonNavUtil.string_or_none (string path, null path, error on wrong type, error on missing key) and JsonTypeString (all 8 match arms plus an I64 property test).

11 new test classes, 4 new builder helpers.

Design: #93

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.
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Mar 3, 2026
@SeanTAllen SeanTAllen merged commit 0d5e110 into main Mar 3, 2026
10 checks passed
@SeanTAllen SeanTAllen deleted the sean/complex-converter-tests branch March 3, 2026 03:01
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Mar 3, 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.

2 participants