Consolidate test helpers into internal/test package#707
Merged
peterstace merged 4 commits intomasterfrom Mar 30, 2026
Merged
Conversation
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.
Description
Consolidates scattered test helper functions into the shared
internal/testpackage, reducing duplication across
geom,geos, andinternal/cartodemotest files. The main
geom/util_test.gofile (324 lines) is removed entirely,with its helpers either moved to
internal/testor inlined where they weresingle-use.
New helpers added to
internal/test:Eq,GT,LT,True,False,Panics,Err,ErrIs,ErrAs,ExactEquals,NotExactEquals,ExactEqualsWKT,DeepEqual,NotDeepEqual,ApproxEqual,ImageToPNG,ReadFile.Also adds a
NewEnvelopeXYconstructor for building anEnvelopefrom variadicx/y coordinate pairs, following the existing
New*XYpattern. This was neededto replace a test-only
envFromRawhelper with a proper API.A tracking document (
test-helper-consolidation.md) is included to captureremaining consolidation opportunities.
Check List
Have you:
Added unit tests?
Yes — existing tests were updated to use the consolidated helpers, and the new
NewEnvelopeXYconstructor has test coverage ingeom/ctor_from_coords_test.go.Add cmprefimpl tests? (if appropriate?)
N/A — this is a test infrastructure change. The cmprefimpl package was updated
to use the shared helpers where applicable.
Updated release notes? (if appropriate?)
Yes — CHANGELOG.md updated with the new
NewEnvelopeXYconstructor.Updated the README.md (if new functionality is added?)
N/A —
NewEnvelopeXYfollows an existing pattern already documented.Related Issue
Benchmark Results
the small
NewEnvelopeXYaddition. No performance impact expected.