Skip to content

✅ Improve tests for v18 - #16

Merged
ets-dorian merged 2 commits into
devfrom
testing
May 14, 2026
Merged

✅ Improve tests for v18#16
ets-dorian merged 2 commits into
devfrom
testing

Conversation

@Michelprogram

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR renames the family of Parse(..., out, ...) entry points to ParseInto(..., dest, ...) across the parser pipeline (session, command, reliable, fragment, connect, acknowledge, parameter decoders), reorders the hooks/dest argument convention, and renames HeaderSessionHeader/CommandHeader and TypeMessageType to disambiguate them. It also reorganizes the reader package by splitting scalar and varint read helpers into dedicated files and substantially improves the v18 parameter test suite by replacing log-only smoke tests with real assertions and removing dead panic-on-error / benchmark scaffolding.

Changes:

  • Rename Parse/parseHeader/parseMetadata to ParseInto/readSessionHeaderInto/readCommandHeaderInto/readReliableHeaderInto/readFragmentHeader, swap the parameter Hooks/dest ordering, rename types.HeaderSessionHeader/CommandHeader and types.TypeMessageType, and delete the unused command/ping and command/disconnect packages.
  • Split internal/reader/reader.go into scalars.go and varint.go, and add doc comments to Skip/ReadRemaining and the context.Context type.
  • Replace the v18 parameter "log-and-pass" tests with real assertions on command type and payload content; rename a few tests for clarity (e.g. TestMalFormedHeaderTestWrongHeader, TestDecodeTestDecodeReliableCommand).

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
parser.go Updates call site to session.ParseInto.
parser_test.go Removes an unused OnCommandSync hook from a v18 test.
internal/types/session.go Renames embedded Header to SessionHeader.
internal/types/command.go Renames HeaderCommandHeader, TypeMessageType, types UnknownPayload field, prunes per-constant doc comments.
internal/types/hooks.go Updates OnEvents map key type to MessageType.
internal/hooks/hooks.go Updates NewHooks to construct OnEvents with MessageType.
internal/context/context.go Adds package-level doc comment for Context.
internal/context/decoders.go Updates ParameterParser interface to ParseInto(reader, hooks, dest).
internal/session/session.go Renames ParseParseInto, drops local Session wrapper, renames helpers.
internal/session/session_test.go Updates to ParseInto and renames TestMalFormedHeaderTestWrongHeader.
internal/command/command.go Renames ParseParseInto, splits header/payload helpers, reorders functions.
internal/command/command_test.go Updates call to command.ParseInto.
internal/command/reliable/reliable.go Renames ParseParseInto, parseHeaderreadReliableHeaderInto, uses MessageType.
internal/command/reliable/reliable_test.go Updates to ParseInto.
internal/command/reliable/fragment.go Renames to ParseIntoFragment/readFragmentHeader, adds doc comment.
internal/command/connect/connect.go Renames ParseParseInto.
internal/command/acknowledge/acknowledge.go Renames ParseParseInto.
internal/command/disconnect/disconnect.go Deletes unused stub package.
internal/command/ping/ping.go Deletes unused stub package.
internal/reader/reader.go Removes scalar/varint helpers (now in separate files), adds doc comments.
internal/reader/scalars.go New file containing all scalar/string/byte read methods.
internal/reader/varint.go New file containing varint read methods.
internal/parameters/v16/parameters.go Renames ParseParseInto, swaps hooks/dest order.
internal/parameters/v16/scan_*_test.go Updates calls to ParseInto.
internal/parameters/v18/parameters.go Renames ParseParseInto, swaps argument order.
internal/parameters/v18/parameters_test.go Replaces log-only tests with real assertions, renames tests, removes dead benchmark/encrypted tests.
internal/parameters/v18/scan_*_test.go Updates calls to ParseInto.
.mise/config.toml Adds coverage-html task and writes coverage profile to ressources/coverage.out.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/parameters/v18/parameters_test.go Outdated
Comment thread internal/parameters/v18/parameters_test.go Outdated
Comment thread internal/types/command.go
@ets-dorian
ets-dorian merged commit f202e39 into dev May 14, 2026
3 checks passed
@ets-dorian
ets-dorian deleted the testing branch May 14, 2026 20:10
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.

3 participants