iancoleman / orderedmap

orderedmap is a golang map where the keys keep the order that they're added. It can be de/serialized from/to JSON. It's based closely on the python collections.OrderedDict.
MIT License
360 stars 55 forks source link

TestOrderedMap has a redundant for loop #33

Closed zamicol closed 1 year ago

zamicol commented 1 year ago

https://github.com/iancoleman/orderedmap/blob/7c914fa9a8916d5034a6b55c92f606b35bc4e5ba/orderedmap_test.go#L68

    // Keys method
    keys := o.Keys()
    expectedKeys := []string{
        "number",
        "string",
        "strings",
        "mixed",
    }
    for i, key := range keys {
        if key != expectedKeys[i] {
            t.Error("Keys method", key, "!=", expectedKeys[i])
        }
    }
    for i, key := range expectedKeys {
        if key != expectedKeys[i] {
            t.Error("Keys method", key, "!=", expectedKeys[i])
        }
    }

The second for loop is not meaningful. I'm assuming that it was meant for a values method or to test values. It's possible it was also copy-pasta.