Merge branch 'erikjohnston-fix-raw-false'

This commit is contained in:
Josh Baker 2017-11-20 11:50:05 -07:00
commit 67e2a63ac7
2 changed files with 10 additions and 1 deletions

View File

@ -511,7 +511,7 @@ func tonum(json string) (raw string, num float64) {
func tolit(json string) (raw string) {
for i := 1; i < len(json); i++ {
if json[i] <= 'a' || json[i] >= 'z' {
if json[i] < 'a' || json[i] > 'z' {
return json[:i]
}
}

View File

@ -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)
}
}
}