You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When updating the existing key with updateValue method the original index is not set back after acquiring it with indexForKey.updateValue(endIndex, forKey: key).
I believe this should be done after the guard statement:
guard let index = indexForKey.updateValue(endIndex, forKey: key) else {
elements.append(.init(key: key, value: newValue))
return nil
}
indexForKey[key] = index
At the moment of writing InsertionOrderedDictionaryTests don't have tests for updateValue.
The following test triggers the assertion:
func test_updateValue() {
var d0 = p0
for (key, value) in p1 {
XCTAssertEqual(d0[key], value)
let replaced = d0.updateValue("*", forKey: key)
XCTAssertEqual(d0[key], "*")
XCTAssertEqual(replaced, value)
}
XCTAssertEqual(d0[99], nil)
}
The text was updated successfully, but these errors were encountered:
When updating the existing
key
withupdateValue
method the originalindex
is not set back after acquiring it withindexForKey.updateValue(endIndex, forKey: key)
.I believe this should be done after the
guard
statement:At the moment of writing
InsertionOrderedDictionaryTests
don't have tests forupdateValue
.The following test triggers the assertion:
The text was updated successfully, but these errors were encountered: