test: add unit tests for gh.zig and tools.zig (#167)#412
Open
Conversation
gh.zig — 12 new tests (from zero): - classifyError: auth required (3 patterns), not found (3), rate limited (3), permission denied (3), unexpected (3 including empty string) - classifyError priority: auth > not-found > rate-limit - errorMessage: all 8 variants return non-empty strings - errorMessage: specific string assertions for AuthRequired, NotFound, Unexpected - containsAny: basic matching, empty inputs - GhResult.deinit: memory safety with testing allocator tools.zig — 5 new tests: - parse: valid tool names round-trip - parse: invalid/empty/uppercase names return null - parse: every Tool enum variant round-trips through @TagName - dispatch: enum variant count assertion (36) for switch coverage - tools_list: JSON contains expected tool names Made-with: Cursor
a384076 to
911fa69
Compare
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.
Summary
gh.zig — 12 new tests (from zero)
classifyError: auth required (3 patterns), not found (3), rate limited (3), permission denied (3), unexpected (3 including empty string)classifyErrorpriority ordering: auth > not-found > rate-limiterrorMessage: all 8 variants return non-empty strings + specific string assertionscontainsAny: basic matching + empty inputsGhResult.deinit: memory safety with testing allocatortools.zig — 5 new tests
parse: valid tool names round-trip correctlyparse: invalid/empty/uppercase names return nullparse: every Tool enum variant round-trips through@tagNametools_list: JSON contains expected tool namesTest plan
zig test src/gh.zig— 12/12 tests passzig ast-check src/tools.zig— clean parseCloses #167