From 48ca9982d8adbc402b750ce43a8a2a03270a98d1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 10 Feb 2023 15:10:46 -0700 Subject: compat/json: Get more of the tests compiling --- compat/json/borrowed_fuzz_test.go | 5 +++-- compat/json/borrowed_stream_test.go | 5 ++--- compat/json/compat_test.go | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'compat/json') diff --git a/compat/json/borrowed_fuzz_test.go b/compat/json/borrowed_fuzz_test.go index 6a0b0d1..a909d75 100644 --- a/compat/json/borrowed_fuzz_test.go +++ b/compat/json/borrowed_fuzz_test.go @@ -7,6 +7,8 @@ package json import ( + "bytes" + "io" "testing" ) @@ -50,8 +52,8 @@ func FuzzUnmarshalJSON(f *testing.F) { }) } -/* // MODIFIED: we don't do tokens func FuzzDecoderToken(f *testing.F) { + f.Skip("we don't have tokens") // MODIFIED: added f.Add([]byte(`{ "object": { "slice": [ @@ -82,4 +84,3 @@ func FuzzDecoderToken(f *testing.F) { } }) } -*/ // MODIFIED: we don't do tokens diff --git a/compat/json/borrowed_stream_test.go b/compat/json/borrowed_stream_test.go index d90898b..d50898a 100644 --- a/compat/json/borrowed_stream_test.go +++ b/compat/json/borrowed_stream_test.go @@ -363,8 +363,6 @@ func TestBlocking(t *testing.T) { } } -//nolint:dupword // False positive, this is commented-out code, not a real comment. // MODIFIED: added nolint declaration -/* // MODIFIED: we don't have tokens type tokenStreamCase struct { json string expTokens []any @@ -446,6 +444,8 @@ var tokenStreamCases = []tokenStreamCase{ } func TestDecodeInStream(t *testing.T) { + t.Parallel() // MODIFIED: added + t.Skip("we don't have tokens") // MODIFIED: added for ci, tcase := range tokenStreamCases { dec := NewDecoder(strings.NewReader(tcase.json)) @@ -479,7 +479,6 @@ func TestDecodeInStream(t *testing.T) { } } } -*/ // MODIFIED: we don't have tokens // Test from golang.org/issue/11893 func TestHTTPDecoding(t *testing.T) { diff --git a/compat/json/compat_test.go b/compat/json/compat_test.go index 203594f..9e4e1cf 100644 --- a/compat/json/compat_test.go +++ b/compat/json/compat_test.go @@ -6,6 +6,7 @@ package json import ( "bytes" + "encoding/json" "io" "git.lukeshu.com/go/lowmemjson" @@ -63,3 +64,12 @@ func (es *encodeState) string(str string, _ bool) { func (es *encodeState) stringBytes(str []byte, _ bool) { jsontest.EncodeStringFromBytes(&es.Buffer, str) } + +type ( + Token = json.Token + Delim = json.Delim +) + +func (dec *Decoder) Token() (Token, error) { + panic("not implemented") +} -- cgit v1.2.3-54-g00ecf