Add tests for IsTaggedNull, IsYNodeEmptySeq and IsYNodeEmptyMap.

This commit is contained in:
jregan
2020-08-09 12:15:22 -07:00
parent 01b34c8ea0
commit 5559601ecb
5 changed files with 98 additions and 13 deletions

View File

@@ -482,7 +482,7 @@ func (s FieldSetter) Filter(rn *RNode) (*RNode, error) {
}
// Clear the field if it is empty, or explicitly null
if s.Value == nil || IsNull(s.Value) {
if s.Value == nil || s.Value.IsTaggedNull() {
return rn.Pipe(Clear(s.Name))
}
@@ -568,7 +568,7 @@ var nodeTypeIndex = map[yaml.Kind]string{
}
func ErrorIfInvalid(rn *RNode, kind yaml.Kind) error {
if rn == nil || rn.YNode() == nil || IsNull(rn) {
if rn == nil || rn.YNode() == nil || rn.IsTaggedNull() {
// node has no type, pass validation
return nil
}