-
-
Save orisano/8aa749cd50fece0a61694ee60b87a208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"testing" | |
stdjson "encoding/json" | |
gojson "github.com/goccy/go-json" | |
) | |
func TestCompact(t *testing.T) { | |
src := []byte(`"\`) | |
if err := stdjson.Compact(bytes.NewBuffer(nil), src); err != nil { | |
t.Error(err) | |
} | |
if err := gojson.Compact(bytes.NewBuffer(nil), src); err != nil { | |
t.Error(err) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- FAIL: TestCompact (0.00s) | |
compact_test.go:14: invalid character ' ' in string escape code | |
panic: runtime error: index out of range [2] with length 2 [recovered] | |
panic: runtime error: index out of range [2] with length 2 | |
goroutine 49 [running]: | |
testing.tRunner.func1.1(0x1144440, 0xc0006a8020) | |
/Users/orisano/sdk/go1.15.6/src/testing/testing.go:1072 +0x30d | |
testing.tRunner.func1(0xc000682480) | |
/Users/orisano/sdk/go1.15.6/src/testing/testing.go:1075 +0x41a | |
panic(0x1144440, 0xc0006a8020) | |
/Users/orisano/sdk/go1.15.6/src/runtime/panic.go:969 +0x1b9 | |
github.com/goccy/go-json.compact(0xc000066f20, 0xc000066f0e, 0x2, 0x2, 0x106b300, 0x1197e80, 0xc00069c020) | |
/Users/orisano/go/pkg/mod/github.com/goccy/go-json@v0.4.3/compact.go:34 +0x469 | |
github.com/goccy/go-json.Compact(...) | |
/Users/orisano/go/pkg/mod/github.com/goccy/go-json@v0.4.3/json.go:349 | |
gojson.TestCompact(0xc000682480) | |
/Users/orisano/works/gojson/compact_test.go:16 +0x125 | |
testing.tRunner(0xc000682480, 0x11758b8) | |
/Users/orisano/sdk/go1.15.6/src/testing/testing.go:1123 +0xef | |
created by testing.(*T).Run | |
/Users/orisano/sdk/go1.15.6/src/testing/testing.go:1168 +0x2b3 | |
exit status 2 | |
FAIL gojson 0.290s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment