feat: Toon SpecGenerator for building unit tests to verify against spec#6
feat: Toon SpecGenerator for building unit tests to verify against spec#6
Conversation
- Implement StringUtils for string manipulation, including escaping and unescaping. - Create ValidationShared for key validation and safety checks. - Introduce ToonDecodeOptions and ToonEncodeOptions for customizable encoding/decoding settings. - Develop ToonDecoder for parsing TOON format strings into JsonNode objects. - Implement ToonEncoder for converting data structures into TOON format strings. - Add ToonFormatException for error handling during parsing and encoding. - Create unit tests for ToonDecoder and ToonEncoder to ensure functionality and data integrity. - Remove outdated UnitTest1.cs file.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Now we have better visibility on which tests are not passing and can start to address them in upcoming PRs |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a test generation tool that automatically creates unit tests from the TOON specification repository, enabling systematic validation of encoder and decoder implementations against the spec. The generated tests cover the V2 spec with noted exceptions for key folding, path expansion, and certain decimal parsing behaviors.
Key Changes
- Created SpecGenerator tool to automatically generate xUnit tests from TOON spec fixtures
- Added comprehensive test coverage for V2 spec including primitives, arrays, objects, delimiters, and whitespace handling
- Implemented
.specignorefile to explicitly skip tests incompatible with .NET constraints - Added convenience scripts (
specgen.shandspecgen.ps1) for easy test regeneration
Reviewed Changes
Copilot reviewed 44 out of 50 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/ToonFormat.SpecGenerator/* | New test generator tool that reads TOON spec fixtures and generates C# unit tests |
| tests/ToonFormat.Tests/Encode/* | Auto-generated encode tests validating TOON encoder output |
| tests/ToonFormat.Tests/Decode/* | Auto-generated decode tests validating TOON decoder behavior |
| .specignore | Configuration file listing tests to skip due to .NET language constraints |
| specgen.sh / specgen.ps1 | Shell scripts for regenerating tests from spec |
| src/ToonFormat/Internal/Decode/* | Fixed Chinese comment translations to English |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
johannschopplich
left a comment
There was a problem hiding this comment.
@ghost1face Thanks for the PR (and generally reviewing the other PRs!). I was only tagged due to changes to the Contributing file – LGTM.
Looks like I'll be needing another maintainer to review myself here. If we can get this in, we can set a good foundation of tests to validate against |
|
I agree. Hopefully more members of the community besides @0xZunia are willing to contribute. Happy to add members to the team that you recommend. |
|
Sorry I'm running out of time right now @ghost1face. |
No problem, I understand we're all busy. I've been moving a little slow only because I want to make sure this is community and not just my preference alone. We'll take things to the discussions for any other passionate maintainers |
|
@239573049 this is our first order of business. Can you review here? Once we have this in place we have a test suite to validate against |
Could you please take a look at these checks and see why they are incorrect? |
|
Could you please check for me why I don't have the merge permission? @johannschopplich |
These checks run a new generated suite of unit tests to validate full compliance to the V2 spec. The code-base isn't yet v2 compliant. Subsequent pull requests will be getting us closer. As far as not having the merge permission, you'll have to approve first as a maintainer. Merging is blocked without a maintainer approval |
|
@239573049 You have to click on the Files changed tab and then the green "Review" button to leave your review:
|



Description
This PR creates tests to quickly validate if code is aligned with a specific spec version.
Unit tests have been generated all pass except for:
Type of Change
Related Issues
Closes #
Changes Made
SPEC Compliance
Testing
Checklist
dotnet formatAdditional Context