Files
603519d158 MUL-6977: test: remove implementation-only coverage (#7932)
* test: remove implementation-only coverage

Co-authored-by: multica-agent <[email protected]>

* test: remove remaining implementation-only coverage

Co-authored-by: multica-agent <[email protected]>

* test: restore compatibility and fragment navigation coverage

Co-authored-by: multica-agent <[email protected]>

* test: preserve behavioral cleanup contracts

Co-authored-by: multica-agent <[email protected]>

---------

Co-authored-by: Sol-Boy <[email protected]>
Co-authored-by: multica-agent <[email protected]>
2026-09-03 13:23:25 +08:00

29 lines
742 B
Go

package taskfailure
import (
"testing"
)
// TestAllReasonsIsDefensiveCopy guards the contract that mutating the
// returned slice cannot corrupt the package-level fixture. Without
// this, two callers (e.g. two Prometheus collectors at startup) could
// race on a shared slice.
func TestAllReasonsIsDefensiveCopy(t *testing.T) {
t.Parallel()
first := AllReasons()
if len(first) == 0 {
t.Fatal("AllReasons() returned empty slice")
}
original := first[0]
first[0] = "tampered"
second := AllReasons()
if second[0] == "tampered" {
t.Fatalf("AllReasons() leaked package state: second call returned tampered value %q", second[0])
}
if second[0] != original {
t.Fatalf("AllReasons()[0] = %q, want %q", second[0], original)
}
}