MCPcopy
hub / github.com/MetaCubeX/mihomo / TestUpdatingDoesntChangePairsOrder

Function TestUpdatingDoesntChangePairsOrder

common/orderedmap/orderedmap_test.go:119–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

117}
118
119func TestUpdatingDoesntChangePairsOrder(t *testing.T) {
120 om := New[string, any]()
121 om.Set("foo", "bar")
122 om.Set("wk", 28)
123 om.Set("po", 100)
124 om.Set("bar", "baz")
125
126 oldValue, present := om.Set("po", 102)
127 assert.Equal(t, 100, oldValue)
128 assert.True(t, present)
129
130 assertOrderedPairsEqual(t, om,
131 []string{"foo", "wk", "po", "bar"},
132 []any{"bar", 28, 102, "baz"})
133}
134
135func TestDeletingAndReinsertingChangesPairsOrder(t *testing.T) {
136 om := New[string, any]()

Callers

nothing calls this directly

Calls 4

assertOrderedPairsEqualFunction · 0.85
NewFunction · 0.70
SetMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected