Exemplo n.º 1
0
func TestMergeRenderableNodes(t *testing.T) {
	nodes1 := render.RenderableNodes{
		"foo": render.RenderableNode{ID: "foo"},
		"bar": render.RenderableNode{ID: "bar"},
	}
	nodes2 := render.RenderableNodes{
		"bar": render.RenderableNode{ID: "bar"},
		"baz": render.RenderableNode{ID: "baz"},
	}
	want := sterilize(render.RenderableNodes{
		"foo": render.RenderableNode{ID: "foo"},
		"bar": render.RenderableNode{ID: "bar"},
		"baz": render.RenderableNode{ID: "baz"},
	}, false)
	nodes1.Merge(nodes2)
	if have := sterilize(nodes1, false); !reflect.DeepEqual(want, have) {
		t.Error(test.Diff(want, have))
	}
}
Exemplo n.º 2
0
func TestMergeRenderableNodes(t *testing.T) {
	nodes1 := render.RenderableNodes{
		"foo": render.NewRenderableNode("foo"),
		"bar": render.NewRenderableNode("bar"),
	}
	nodes2 := render.RenderableNodes{
		"bar": render.NewRenderableNode("bar"),
		"baz": render.NewRenderableNode("baz"),
	}
	want := expected.Sterilize(render.RenderableNodes{
		"foo": render.NewRenderableNode("foo"),
		"bar": render.NewRenderableNode("bar"),
		"baz": render.NewRenderableNode("baz"),
	})
	have := nodes1.Merge(nodes2)
	if !reflect.DeepEqual(want, have) {
		t.Error(test.Diff(want, have))
	}
}
Exemplo n.º 3
0
func TestMergeRenderableNodes(t *testing.T) {
	nodes1 := render.RenderableNodes{
		"foo": render.RenderableNode{ID: "foo"},
		"bar": render.RenderableNode{ID: "bar"},
	}
	nodes2 := render.RenderableNodes{
		"bar": render.RenderableNode{ID: "bar"},
		"baz": render.RenderableNode{ID: "baz"},
	}

	want := render.RenderableNodes{
		"foo": render.RenderableNode{ID: "foo"},
		"bar": render.RenderableNode{ID: "bar"},
		"baz": render.RenderableNode{ID: "baz"},
	}
	nodes1.Merge(nodes2)

	if !reflect.DeepEqual(want, nodes1) {
		t.Errorf("want %+v, have %+v", want, nodes1)
	}
}