MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_Map

Function TestSpec_PublicAPI_Map

pkg/sliceutil/spec_test.go:32–46  ·  view source on GitHub ↗

TestSpec_PublicAPI_Map validates the documented behavior of Map as described in the sliceutil README.md specification.

(t *testing.T)

Source from the content-addressed store, hash-verified

30// TestSpec_PublicAPI_Map validates the documented behavior of Map as described
31// in the sliceutil README.md specification.
32func TestSpec_PublicAPI_Map(t *testing.T) {
33 t.Run("applies transform to every element", func(t *testing.T) {
34 names := []string{"alice", "bob"}
35 upper := Map(names, strings.ToUpper)
36 assert.Equal(t, []string{"ALICE", "BOB"}, upper, "Map should transform all elements")
37 })
38
39 t.Run("does not modify input slice", func(t *testing.T) {
40 original := []string{"alice", "bob"}
41 input := make([]string, len(original))
42 copy(input, original)
43 _ = Map(input, strings.ToUpper)
44 assert.Equal(t, original, input, "Map must not modify the input slice")
45 })
46}
47
48// TestSpec_PublicAPI_MapKeys validates the documented behavior of MapKeys
49// as described in the sliceutil README.md specification.

Callers

nothing calls this directly

Calls 2

MapFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected