Skip to content

test: add nil-pointer V and zero-value V edge-case tests #42

@millerjp

Description

@millerjp

Summary

No test verifies that storing (*T)(nil) under a pointer V returns (nil, true) on Load — distinct from a missing key returning (nil, false). A consumer caching optional resources (SyncMap[string, *Session] where nil means "known-absent upstream") has no safety evidence today.

Separate but related: no test verifies that var v V (zero-value struct) distinguished from missing for struct V.

Scope

  • TestLoad_PointerV_NilStored — Store (nil *T), Load returns (nil, true). Re-Store non-nil, Load returns (non-nil, true). Delete, Load returns (nil, false).
  • Same pattern for TestLoadAndDelete_PointerV_NilStored and TestSwap_PointerV_NilStored.
  • TestLoad_StructV_ZeroVsMissing — store User{} (zero struct), Load returns (User{}, true). Missing key returns (User{}, false). Assert the ok bit is the distinguishing signal.

Acceptance criteria

  1. Four new tests, all parallel, all clean under -race.
  2. No change to library behaviour.

Source: test-analyst agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Blocks releasetestingTests: unit, BDD, benchmarks, fuzz

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions