Skip to content

AddOrSetValue Bug #7

@gorepj

Description

@gorepj

Good morning
I have come across a bug in my use of Neslib.Yaml
When a node contains more than 10 child nodes The AddOrSetValue function incorrectly Updates value in the Document

Test Case
procedure MyProc
var
Doc: IYamlDocument;
begin
Doc := TYamlDocument.CreateMapping;
for var i := 0 to 16 do
begin
outputdebugstring(PChar(doc.Root.Values['ATestNode'].ToString('Empty'))); //Note this value after 10 or so updates
Doc.Root.AddOrSetValue('Name'+i.tostring, i);
Doc.Root.AddOrSetValue('ATestNode', 'TestValue');
end;
mmoYAML.Lines.Text := doc.ToYaml;
end;

resultant YAML

There are several lines referring to ATestNode

Name0: 0
ATestNode: TestValue
Name1: 1
Name2: 2
Name3: 3
Name4: 4
Name5: 5
Name6: 6
Name7: 7
Name8: 8
Name9: 9
Name10: 10
Name11: 11
ATestNode: TestValue
Name12: 12
Name13: 13
ATestNode: TestValue
Name14: 14
Name15: 15
ATestNode: TestValue
Name16: 16
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions