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

Function TestSpec_PublicAPI_MapKeys

pkg/sliceutil/spec_test.go:50–62  ·  view source on GitHub ↗

TestSpec_PublicAPI_MapKeys validates the documented behavior of MapKeys as described in the sliceutil README.md specification.

(t *testing.T)

Source from the content-addressed store, hash-verified

48// TestSpec_PublicAPI_MapKeys validates the documented behavior of MapKeys
49// as described in the sliceutil README.md specification.
50func TestSpec_PublicAPI_MapKeys(t *testing.T) {
51 t.Run("returns all map keys as a slice", func(t *testing.T) {
52 m := map[string]int{"a": 1, "b": 2}
53 keys := MapKeys(m)
54 assert.ElementsMatch(t, []string{"a", "b"}, keys, "MapKeys should return all map keys (order not guaranteed)")
55 })
56
57 t.Run("returns empty slice for empty map", func(t *testing.T) {
58 m := map[string]int{}
59 keys := MapKeys(m)
60 assert.Empty(t, keys, "MapKeys of empty map should return empty slice")
61 })
62}
63
64// TestSpec_PublicAPI_FilterMapKeys validates the documented behavior of
65// FilterMapKeys as described in the sliceutil README.md specification.

Callers

nothing calls this directly

Calls 2

MapKeysFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected