| 761 | } |
| 762 | |
| 763 | func TestJQWithArrayQueryProducesRequiredArray(t *testing.T) { |
| 764 | t.Parallel() |
| 765 | input := `{"timestamp": 1649264191, "iss_position": {"longitude": "52.8439", "latitude": "10.8107"}, "message": "success"}` |
| 766 | want := `["10.8107","52.8439"]` + "\n" |
| 767 | got, err := script.Echo(input).JQ("[.iss_position.latitude, .iss_position.longitude]").String() |
| 768 | if err != nil { |
| 769 | t.Fatal(err) |
| 770 | } |
| 771 | if want != got { |
| 772 | t.Error(cmp.Diff(want, got)) |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | func TestJQWithArrayInputAndElementQueryProducesSelectedElement(t *testing.T) { |
| 777 | t.Parallel() |