forked from mirror/gjson
added emoji test
This commit is contained in:
parent
01736e2faf
commit
20d521de6e
|
@ -63,6 +63,17 @@ func TestRandomValidStrings(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEmoji(t *testing.T) {
|
||||||
|
const input = `{"utf8":"Example emoji, KO: \ud83d\udd13, \ud83c\udfc3 OK: \u2764\ufe0f "}`
|
||||||
|
value := Get(input, "utf8")
|
||||||
|
var s string
|
||||||
|
json.Unmarshal([]byte(value.Raw), &s)
|
||||||
|
if value.String() != s {
|
||||||
|
t.Fatalf("expected '%v', got '%v'", s, value.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testEscapePath(t *testing.T, json, path, expect string) {
|
func testEscapePath(t *testing.T, json, path, expect string) {
|
||||||
if Get(json, path).String() != expect {
|
if Get(json, path).String() != expect {
|
||||||
t.Fatalf("expected '%v', got '%v'", expect, Get(json, path).String())
|
t.Fatalf("expected '%v', got '%v'", expect, Get(json, path).String())
|
||||||
|
|
Loading…
Reference in New Issue