File: sort_test.go

package info (click to toggle)
golang-github-aws-aws-sdk-go 1.49.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312,636 kB
  • sloc: makefile: 120
file content (20 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package xml

import (
	"bytes"
	"reflect"
	"testing"
)

func TestSortXML(t *testing.T) {
	xmlInput := bytes.NewReader([]byte(`<Root><cde>xyz</cde><abc>123</abc><xyz><item>1</item></xyz></Root>`))
	sortedXML, err := SortXML(xmlInput, false)
	expectedsortedXML := `<Root><abc>123</abc><cde>xyz</cde><xyz><item>1</item></xyz></Root>`
	if err != nil {
		t.Fatalf("expected no error, got %v", err)
	}

	if !reflect.DeepEqual(sortedXML, expectedsortedXML) {
		t.Errorf("expect match\nexpect: %+v\nactual: %+v\n", expectedsortedXML, sortedXML)
	}
}