summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/xml/xml_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/encoding/xml/xml_test.go')
-rw-r--r--src/pkg/encoding/xml/xml_test.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pkg/encoding/xml/xml_test.go b/src/pkg/encoding/xml/xml_test.go
index eeedbe575..7723ab1c9 100644
--- a/src/pkg/encoding/xml/xml_test.go
+++ b/src/pkg/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)
+ }
+}