| 1709 | } |
| 1710 | |
| 1711 | func TestQueryArrayValues(t *testing.T) { |
| 1712 | json := `{ |
| 1713 | "artists": [ |
| 1714 | ["Bob Dylan"], |
| 1715 | "John Lennon", |
| 1716 | "Mick Jagger", |
| 1717 | "Elton John", |
| 1718 | "Michael Jackson", |
| 1719 | "John Smith", |
| 1720 | true, |
| 1721 | 123, |
| 1722 | 456, |
| 1723 | false, |
| 1724 | null |
| 1725 | ] |
| 1726 | }` |
| 1727 | assert(t, Get(json, `a*.#[0="Bob Dylan"]#|#`).String() == "1") |
| 1728 | assert(t, Get(json, `a*.#[0="Bob Dylan 2"]#|#`).String() == "0") |
| 1729 | assert(t, Get(json, `a*.#[%"John*"]#|#`).String() == "2") |
| 1730 | assert(t, Get(json, `a*.#[_%"John*"]#|#`).String() == "0") |
| 1731 | assert(t, Get(json, `a*.#[="123"]#|#`).String() == "1") |
| 1732 | } |
| 1733 | |
| 1734 | func TestParenQueries(t *testing.T) { |
| 1735 | json := `{ |