romshark / jscan

High performance JSON iterator & validator for Go
BSD 3-Clause "New" or "Revised" License
88 stars 7 forks source link

Valid: improper string validation #4

Closed ernado closed 2 years ago

ernado commented 2 years ago
package jscan

import (
    "encoding/json"
    "testing"
)

func TestValid(t *testing.T) {
    for _, v := range []string{
        "\"\x01\"",
    } {
        if json.Valid([]byte(v)) != Valid(v) {
            t.Errorf("%#v", v)
        }
    }
}
=== RUN   TestValid
    valid_test.go:13: "\"\x01\""
--- FAIL: TestValid (0.00s)
=== RUN   TestValid
--- PASS: TestValid (0.00s)

FAIL