summaryrefslogtreecommitdiff
path: root/libvirt/domain_def_test.go
blob: 9d0eee758203d9f467e66dc62a5390dc88c116bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package libvirt

import (
	"bytes"
	"encoding/xml"
	"testing"

	"github.com/davecgh/go-spew/spew"
)

func init() {
	spew.Config.Indent = "\t"
}

func TestDefaultDomainMarshall(t *testing.T) {
	b := newDomainDef()
	prettyB := spew.Sdump(b)
	t.Logf("Parsed default domain:\n%s", prettyB)

	buf := new(bytes.Buffer)
	enc := xml.NewEncoder(buf)
	enc.Indent("  ", "    ")
	if err := enc.Encode(b); err != nil {
		t.Fatalf("could not marshall this:\n%s", spew.Sdump(b))
	}
	t.Logf("Marshalled default domain:\n%s", buf.String())
}