MCPcopy
hub / github.com/bitfield/script / TestJQProducesValidResultsUntilFirstError

Function TestJQProducesValidResultsUntilFirstError

script_test.go:846–857  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

844}
845
846func 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
859func TestLastDropsAllButLastNLinesOfInput(t *testing.T) {
860 t.Parallel()

Callers

nothing calls this directly

Calls 4

EchoFunction · 0.92
StringMethod · 0.80
JQMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…