diff options
author | Ian Lance Taylor <iant@google.com> | 2016-02-03 21:58:02 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-02-03 21:58:02 +0000 |
commit | f98dd1a338867a408f7c72d73fbad7fe7fc93e3a (patch) | |
tree | 2f8da9862a9c1fe0df138917f997b03439c02773 /libgo/go/encoding/json/encode_test.go | |
parent | b081ed4efc144da0c45a6484aebfd10e0eb9fda3 (diff) | |
download | gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.zip gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.tar.gz gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.tar.bz2 |
libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200
From-SVN: r233110
Diffstat (limited to 'libgo/go/encoding/json/encode_test.go')
-rw-r--r-- | libgo/go/encoding/json/encode_test.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libgo/go/encoding/json/encode_test.go b/libgo/go/encoding/json/encode_test.go index 7abfa85..c00491e 100644 --- a/libgo/go/encoding/json/encode_test.go +++ b/libgo/go/encoding/json/encode_test.go @@ -381,16 +381,10 @@ func TestStringBytes(t *testing.T) { r = append(r, i) } s := string(r) + "\xff\xff\xffhello" // some invalid UTF-8 too - _, err := es.string(s) - if err != nil { - t.Fatal(err) - } + es.string(s) esBytes := &encodeState{} - _, err = esBytes.stringBytes([]byte(s)) - if err != nil { - t.Fatal(err) - } + esBytes.stringBytes([]byte(s)) enc := es.Buffer.String() encBytes := esBytes.Buffer.String() @@ -443,6 +437,18 @@ func TestIssue6458(t *testing.T) { } } +func TestIssue10281(t *testing.T) { + type Foo struct { + N Number + } + x := Foo{Number(`invalid`)} + + b, err := Marshal(&x) + if err == nil { + t.Errorf("Marshal(&x) = %#q; want error", b) + } +} + func TestHTMLEscape(t *testing.T) { var b, want bytes.Buffer m := `{"M":"<html>foo &` + "\xe2\x80\xa8 \xe2\x80\xa9" + `</html>"}` |