func TestXml(t *testing.T) {
	svg := NewSvg()
	svg.Groups = []*Group{&Group{
		Groups: []*Group{
			&Group{},  
			&Group{},
		},
		Texts: []*Text{
			&Text{Text: "Hello"},                         
			&Text{Text: "world", Style: "opacity: 0.5"},  
		},
		Paths: []*Path{
			&Path{Desc: "M100,200 C100,100 250,100 250,200 S400,300 400,200"},  
			&Path{},  
		},
	}}
	expectedOut := `<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="none">
  <defs></defs>
  <g>
    <g></g>
    <g></g>
    <path d="M100,200 C100,100 250,100 250,200 S400,300 400,200"></path>
    <path d=""></path>
    <text>Hello</text>
    <text style="opacity: 0.5">world</text>
  </g>
</svg>`
	out, err := xml.MarshalIndent(svg, "", "  ")
	if err != nil {
		t.Error(err)
	}
	if string(out) != expectedOut {
		t.Errorf("svg output is not as expected\n"+
			"got:\n%s\n\n"+
			"want:\n%s\n",
			string(out),
			expectedOut,
		)
	}
}
Test basic encoding of svg/xml elements
package draw2dsvg
import (
	"encoding/xml"
	"testing"
)