MCPcopy Create free account
hub / github.com/elliotchance/orderedmap / TestOrderedMap_Copy

Function TestOrderedMap_Copy

v3/orderedmap_test.go:281–293  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

279}
280
281func TestOrderedMap_Copy(t *testing.T) {
282 t.Run("ReturnsEqualButNotSame", func(t *testing.T) {
283 key, value := 1, "a value"
284 m := orderedmap.NewOrderedMap[int, string]()
285 m.Set(key, value)
286
287 m2 := m.Copy()
288 m2.Set(key, "a different value")
289
290 assert.Equal(t, m.Len(), m2.Len(), "not all elements are copied")
291 assert.Equal(t, value, m.GetElement(key).Value)
292 })
293}
294
295func TestGetElement(t *testing.T) {
296 t.Run("ReturnsElementForKey", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

SetMethod · 0.95
CopyMethod · 0.95
LenMethod · 0.95
GetElementMethod · 0.95
SetMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…