(t *testing.T)
| 844 | } |
| 845 | |
| 846 | func TestJQProducesValidResultsUntilFirstError(t *testing.T) { |
| 847 | t.Parallel() |
| 848 | input := "[1]\ninvalid JSON value\n[2]" |
| 849 | want := "1\n" |
| 850 | got, err := script.Echo(input).JQ(".[0]").String() |
| 851 | if err == nil { |
| 852 | t.Error("want error from invalid JSON input, got nil") |
| 853 | } |
| 854 | if want != got { |
| 855 | t.Error(cmp.Diff(want, got)) |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | func TestLastDropsAllButLastNLinesOfInput(t *testing.T) { |
| 860 | t.Parallel() |