test: add first Go unit suite (primitives, config, abi, wallet)#27
Merged
Conversation
The repository had no Go tests. This adds a focused, network-free suite over the pure/deterministic packages, runnable with `go test ./...`: - primitives: All/IsValid plus Registry invariants (build/ABI/target per kind) - config: TOML Load/Save round-trip, local-node default injection, primitive inference from legacy sections, missing-file error, HasPrimitive - abi: ParseContract over annotated Rust (params/flag/return), invalid-type and name-mismatch errors, IsValidType/GetTypeInfo - wallet: ValidateSeed/ValidateAddress, SeedToAddress known-answer vector (masterpassphrase) + determinism, GenerateWallet round-trip, getAlgorithm Tests are table-driven and use t.TempDir(). One assertion documents a subtle parser behaviour surfaced while writing it: @Flag is positional and applies to the @param annotations that follow it. 21 test functions, all green; go vet and gofmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`primitives` is a root-level key in bedrock.toml (Config.Primitives is a top-level field), but generateConfig and every doc example emitted it under [project], where TOML parses it as project.primitives and Load silently drops it. cfg.Primitives was only repopulated by the section-inference fallback, so the explicit list users edit had no effect. Move the key above [project] in the scaffolder and all examples, and assert root-level loading in the config test (it previously nested the key under [project] and never checked it loaded).
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.
Context
The repository currently has no Go tests. This PR adds a first, focused unit suite over the pure / deterministic packages — no node, Docker, or network required — so
go test ./...gives a real safety net and a foundation to grow.Coverage
primitivesAll/IsValid;Registryinvariants (every kind builds, contract needs an ABI, escrow/vault don't, correct WASM targets)configLoad/Saveround-trip, local-node default injection, primitive inference from legacy[contracts]/[escrows]sections, missing-file error,HasPrimitiveabiParseContractover annotated Rust (params,@flag,@return), invalid-type and name-mismatch errors,IsValidType/GetTypeInfowalletValidateSeed/ValidateAddress,SeedToAddressknown-answer vector (masterpassphrase →rHb9C…tyTh) + determinism,GenerateWalletround-trip,getAlgorithmNotes
t.TempDir()for fixtures,got/wanterror messages — standard Go idioms.go vet ./...andgofmtclean.@flagis positional — it applies to the@paramannotations that follow it, not the ones before.Independent of #26 (the P1 bug-fix PR); branched from
mainand touches only*_test.gofiles.🤖 Generated with Claude Code