diff options
Diffstat (limited to 'libgo/go/encoding/xml/xml_test.go')
-rw-r--r-- | libgo/go/encoding/xml/xml_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libgo/go/encoding/xml/xml_test.go b/libgo/go/encoding/xml/xml_test.go index eeedbe575f8..7723ab1c9f0 100644 --- a/libgo/go/encoding/xml/xml_test.go +++ b/libgo/go/encoding/xml/xml_test.go @@ -11,6 +11,7 @@ import ( "reflect" "strings" "testing" + "unicode/utf8" ) const testInput = ` @@ -246,10 +247,8 @@ func (d *downCaser) Read(p []byte) (int, error) { } func TestRawTokenAltEncoding(t *testing.T) { - sawEncoding := "" d := NewDecoder(strings.NewReader(testInputAltEncoding)) d.CharsetReader = func(charset string, input io.Reader) (io.Reader, error) { - sawEncoding = charset if charset != "x-testing-uppercase" { t.Fatalf("unexpected charset %q", charset) } @@ -714,3 +713,14 @@ func TestEscapeTextInvalidChar(t *testing.T) { t.Errorf("have %v, want %v", text, expected) } } + +func TestIssue5880(t *testing.T) { + type T []byte + data, err := Marshal(T{192, 168, 0, 1}) + if err != nil { + t.Errorf("Marshal error: %v", err) + } + if !utf8.Valid(data) { + t.Errorf("Marshal generated invalid UTF-8: %x", data) + } +} |