Fixed to_entries and del bug #1886

This commit is contained in:
Mike Farah
2023-11-30 14:04:54 +11:00
parent c11a53322b
commit 730f240d24
5 changed files with 28 additions and 7 deletions
+13
View File
@@ -147,3 +147,16 @@ func TestGetParsedKeyForArrayValue(t *testing.T) {
n := CandidateNode{Key: key, Value: "meow", document: 3}
test.AssertResult(t, 4, n.getParsedKey())
}
func TestCandidateNodeAddKeyValueChild(t *testing.T) {
key := CandidateNode{Value: "cool", IsMapKey: true}
node := CandidateNode{}
// if we use a key in a new node as a value, it should no longer be marked as a key
_, keyIsValueNow := node.AddKeyValueChild(&CandidateNode{Value: "newKey"}, &key)
test.AssertResult(t, keyIsValueNow.IsMapKey, false)
test.AssertResult(t, key.IsMapKey, true)
}