...

Source file src/github.com/aws/smithy-go/testing/xml/sort_test.go

Documentation: github.com/aws/smithy-go/testing/xml

     1  package xml
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  )
     7  
     8  func TestSortXML(t *testing.T) {
     9  	xmlInput := bytes.NewReader([]byte(`<Root><cde>xyz</cde><abc>123</abc><xyz><item>1</item></xyz></Root>`))
    10  	sortedXML, err := SortXML(xmlInput, false)
    11  	expectedsortedXML := `<Root><abc>123</abc><cde>xyz</cde><xyz><item>1</item></xyz></Root>`
    12  	if err != nil {
    13  		t.Fatalf("expected no error, got %v", err)
    14  	}
    15  
    16  	if expectedsortedXML != sortedXML {
    17  		t.Fatalf("found diff: %v != %v", expectedsortedXML, sortedXML)
    18  	}
    19  }
    20  

View as plain text