Skip to content

Refactor yamlassert to fluent String/Bytes/Reader assertion types and update examples/tests#12

Merged
nfisher merged 1 commit into
mainfrom
codex/add-wrapper-structs-and-constructor-functions
Jun 22, 2026
Merged

Refactor yamlassert to fluent String/Bytes/Reader assertion types and update examples/tests#12
nfisher merged 1 commit into
mainfrom
codex/add-wrapper-structs-and-constructor-functions

Conversation

@nfisher

@nfisher nfisher commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Motivation

  • Simplify and unify the YAML assertion API by providing typed assertion builders for string, byte slice, and reader inputs to enable fluent method calls.
  • Make the YAML assertions more explicit and discoverable via String, Bytes, and Reader entry points instead of many top-level functions.

Description

  • Introduced StringAssert, BytesAssert, and ReaderAssert types and constructors String(), Bytes(), and Reader() and converted top-level functions into methods such as EqualTo, EqualToWithOptions, IsValid, Contains, PathExists, PathMissing, PathEqual, ArrayContains, DocumentCount, DocumentEqual, and DocumentContains on those types.
  • Reworked EqualReader/EqualBytes/Equal flows to use the new fluent API internally and preserved option handling via Option (e.g. IgnorePaths and UnorderedArraysAt).
  • Updated hammy/README.md, the hammy/yamlassert examples (example_test.go), and unit tests (yamlassert_test.go) to use the new API names and method calls, and updated the feature checklist to reflect the nested String/Bytes/Reader assertions.

Testing

  • Ran unit tests for the package using go test ./... and updated tests in hammy/yamlassert to use the new API, and all tests passed.
  • Updated example tests in hammy/yamlassert/example_test.go to assert behavior via the new builders and verified their output in test runs.

Codex Task

@nfisher nfisher merged commit 25506d6 into main Jun 22, 2026
1 check passed
@nfisher nfisher deleted the codex/add-wrapper-structs-and-constructor-functions branch June 22, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant