Updated integration tests

This commit is contained in:
Trial97
2021-03-25 16:50:47 +02:00
committed by Dan Christian Bogos
parent b8437f4a7d
commit fc2f7631bd
8 changed files with 14 additions and 11 deletions

View File

@@ -115,6 +115,9 @@ func (n *DataNode) Field(path []string) (*DataLeaf, error) {
if len(path) == 0 {
return nil, ErrWrongPath
}
if path[0] == Length {
return &DataLeaf{Data: len(n.Slice)}, nil
}
idx, err := strconv.Atoi(path[0]) // convert the path to index
if err != nil {
return nil, err
@@ -154,6 +157,9 @@ func (n *DataNode) fieldAsInterface(path []string) (interface{}, error) {
if len(path) == 0 {
return n.Slice, nil
}
if path[0] == Length {
return len(n.Slice), nil
}
idx, err := strconv.Atoi(path[0]) // convert the path to index
if err != nil {
return nil, err