Skip to content

Add typed assertion helpers and tests for errors, filesystem, floats, slices, maps, readers, and URLs#10

Merged
nfisher merged 4 commits into
mainfrom
codex/implement-typed-assertions-in-gunit
Jun 17, 2026
Merged

Add typed assertion helpers and tests for errors, filesystem, floats, slices, maps, readers, and URLs#10
nfisher merged 4 commits into
mainfrom
codex/implement-typed-assertions-in-gunit

Conversation

@nfisher

@nfisher nfisher commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Motivation

  • Expand the set of typed assertion helpers to make table-driven and generic tests more expressive and convenient across common types and behaviors.
  • Provide assertions for I/O and URL validation to reduce boilerplate in tests that need to inspect readers and parsed URLs.

Description

  • Added typed assertion implementations in error.go, filesystem.go, float.go, slice.go, reader.go, and url.go, including helpers such as NilError, ErrorContains, FileExists, NoFileExists, Float(...).CloseTo, Slice(...).Contains, Reader(...).EqualToString, and URL(...)/ParseURL(...) with query helpers.
  • Extended map assertions in map.go with HasKey, NotHasKey, KeysExactly, NotEmpty/IsNotEmpty, NotContains, Len, WithItem, WithItems, and WithoutItems to support more map-centric checks.
  • Added convenience aliases and tweaks such as Number(...).NotEqual, Str(...).NotContains, and Str(...).NotEmpty in number.go and string.go.
  • Added comprehensive unit tests for each assertion in new _typed_test.go files and a small test helper file typed_assertion_helpers_test.go providing makeTempDirAndFile, testURL, and testMap utilities.

Testing

  • Ran the test suite with go test ./... which exercised the new typed assertion tests in the added files such as error_typed_test.go, filesystem_typed_test.go, float_typed_test.go, slice_typed_test.go, map_typed_test.go, reader_typed_test.go, and url_typed_test.go.
  • All newly added unit tests passed successfully under the executed test run.

Codex Task

@nfisher nfisher merged commit 8c51784 into main Jun 17, 2026
1 check passed
@nfisher nfisher deleted the codex/implement-typed-assertions-in-gunit branch June 17, 2026 20:31
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