Delete non-rnode stuff from rnode.go.

This commit is contained in:
jregan
2020-08-16 07:35:11 -07:00
parent 0590b225c7
commit c4c8decb74
2 changed files with 0 additions and 311 deletions

View File

@@ -167,61 +167,6 @@ type: string
assert.Equal(t, expected, actual)
}
func TestIsYNodeTaggedNull(t *testing.T) {
if IsYNodeTaggedNull(nil) {
t.Fatalf("nil cannot be tagged null")
}
if IsYNodeTaggedNull(&Node{}) {
t.Fatalf("untagged node is not tagged")
}
if IsYNodeTaggedNull(&Node{Tag: NodeTagFloat}) {
t.Fatalf("float tagged node is not tagged")
}
if !IsYNodeTaggedNull(&Node{Tag: NodeTagNull}) {
t.Fatalf("tagged node is tagged")
}
}
func TestIsYNodeEmptyMap(t *testing.T) {
if IsYNodeEmptyMap(nil) {
t.Fatalf("nil cannot be a map")
}
if IsYNodeEmptyMap(&Node{}) {
t.Fatalf("raw node is not a map")
}
if IsYNodeEmptyMap(&Node{Kind: SequenceNode}) {
t.Fatalf("seq node is not a map")
}
n := &Node{Kind: MappingNode}
if !IsYNodeEmptyMap(n) {
t.Fatalf("empty mapping node is an empty mapping node")
}
n.Content = append(n.Content, &Node{Kind: SequenceNode})
if IsYNodeEmptyMap(n) {
t.Fatalf("a node with content isn't empty")
}
}
func TestIsYNodeEmptySeq(t *testing.T) {
if IsYNodeEmptySeq(nil) {
t.Fatalf("nil cannot be a map")
}
if IsYNodeEmptySeq(&Node{}) {
t.Fatalf("raw node is not a map")
}
if IsYNodeEmptySeq(&Node{Kind: MappingNode}) {
t.Fatalf("map node is not a sequence")
}
n := &Node{Kind: SequenceNode}
if !IsYNodeEmptySeq(n) {
t.Fatalf("empty sequence node is an empty sequence node")
}
n.Content = append(n.Content, &Node{Kind: MappingNode})
if IsYNodeEmptySeq(n) {
t.Fatalf("a node with content isn't empty")
}
}
func TestIsMissingOrNull(t *testing.T) {
if !IsMissingOrNull(nil) {
t.Fatalf("input: nil")
@@ -356,46 +301,3 @@ func TestRNodeIsNilOrEmpty(t *testing.T) {
t.Fatalf("non-empty list should not be empty")
}
}
func TestMapNodeIsNilOrEmpty(t *testing.T) {
var mn *MapNode
if !mn.IsNilOrEmpty() {
t.Fatalf("nil should be empty")
}
mn = &MapNode{Key: MakeNullNode()}
if !mn.IsNilOrEmpty() {
t.Fatalf("missing value should be empty")
}
mn.Value = NewRNode(nil)
if !mn.IsNilOrEmpty() {
t.Fatalf("missing value YNode should be empty")
}
mn.Value = MakeNullNode()
if !mn.IsNilOrEmpty() {
t.Fatalf("value tagged null should be empty")
}
mn.Value = NewMapRNode(nil)
if !mn.IsNilOrEmpty() {
t.Fatalf("empty map should be empty")
}
mn.Value = NewMapRNode(&map[string]string{"foo": "bar"})
if mn.IsNilOrEmpty() {
t.Fatalf("non-empty map should not be empty")
}
mn.Value = NewListRNode()
if !mn.IsNilOrEmpty() {
t.Fatalf("empty list should be empty")
}
mn.Value = NewListRNode("foo")
if mn.IsNilOrEmpty() {
t.Fatalf("non-empty list should not be empty")
}
}