Skip to content

Consolidate test helpers into internal/test package#707

Merged
peterstace merged 4 commits intomasterfrom
consolidate_test_utilities
Mar 30, 2026
Merged

Consolidate test helpers into internal/test package#707
peterstace merged 4 commits intomasterfrom
consolidate_test_utilities

Conversation

@peterstace
Copy link
Copy Markdown
Owner

Description

Consolidates scattered test helper functions into the shared internal/test
package, reducing duplication across geom, geos, and internal/cartodemo
test files. The main geom/util_test.go file (324 lines) is removed entirely,
with its helpers either moved to internal/test or inlined where they were
single-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 NewEnvelopeXY constructor for building an Envelope from variadic
x/y coordinate pairs, following the existing New*XY pattern. This was needed
to replace a test-only envFromRaw helper with a proper API.

A tracking document (test-helper-consolidation.md) is included to capture
remaining consolidation opportunities.

Check List

Have you:

  • Added unit tests?

    Yes — existing tests were updated to use the consolidated helpers, and the new
    NewEnvelopeXY constructor has test coverage in geom/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 NewEnvelopeXY constructor.

  • Updated the README.md (if new functionality is added?)

    N/A — NewEnvelopeXY follows an existing pattern already documented.

Related Issue

  • No related issue.

Benchmark Results

  • N/A — this is a test-only refactor with no production code changes other than
    the small NewEnvelopeXY addition. No performance impact expected.

@peterstace peterstace merged commit 9e03a2b into master Mar 30, 2026
1 check passed
@peterstace peterstace deleted the consolidate_test_utilities branch March 30, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant