forked from mirror/gjson
Merge branch 'erikjohnston-fix-raw-false'
This commit is contained in:
commit
67e2a63ac7
2
gjson.go
2
gjson.go
|
@ -511,7 +511,7 @@ func tonum(json string) (raw string, num float64) {
|
||||||
|
|
||||||
func tolit(json string) (raw string) {
|
func tolit(json string) (raw string) {
|
||||||
for i := 1; i < len(json); i++ {
|
for i := 1; i < len(json); i++ {
|
||||||
if json[i] <= 'a' || json[i] >= 'z' {
|
if json[i] < 'a' || json[i] > 'z' {
|
||||||
return json[:i]
|
return json[:i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1101,3 +1101,12 @@ func TestGetMany48(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestResultRawForLiteral(t *testing.T) {
|
||||||
|
for _, lit := range []string{"null", "true", "false"} {
|
||||||
|
result := Parse(lit)
|
||||||
|
if result.Raw != lit {
|
||||||
|
t.Fatalf("expected '%v', got '%v'", lit, result.Raw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue