Merge pull request #76 from goccy/feature/fix-decoder

Fix streaming decoder for float value
This commit is contained in:
Masaaki Goshima 2020-12-27 21:27:40 +09:00 committed by GitHub
commit 754ebd48b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View File

@ -114,9 +114,6 @@ func (d *floatDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
if err != nil {
return err
}
if !validEndNumberChar[s.char()] {
return errUnexpectedEndOfJSON("float", s.totalOffset())
}
str := *(*string)(unsafe.Pointer(&bytes))
f64, err := strconv.ParseFloat(str, 64)
if err != nil {

View File

@ -12,6 +12,7 @@ import (
"net"
"net/http"
"net/http/httptest"
"reflect"
"strings"
"testing"
@ -186,7 +187,6 @@ func nlines(s string, n int) string {
return s
}
/*
func TestDecoder(t *testing.T) {
for i := 0; i <= len(streamTest); i++ {
// Use stream without newlines as input,
@ -218,7 +218,6 @@ func TestDecoder(t *testing.T) {
}
}
}
*/
func TestDecoderBuffered(t *testing.T) {
r := strings.NewReader(`{"Name": "Gopher"} extra `)