MCPcopy Index your code
hub / github.com/bitfield/script / TestJQWithDotQueryPrettyPrintsInput

Function TestJQWithDotQueryPrettyPrintsInput

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

Source from the content-addressed store, hash-verified

734}
735
736func TestJQWithDotQueryPrettyPrintsInput(t *testing.T) {
737 t.Parallel()
738 input := `{"timestamp": 1649264191, "iss_position": {"longitude": "52.8439", "latitude": "10.8107"}, "message": "success"}`
739 // Fields should be sorted by key, with whitespace removed
740 want := `{"iss_position":{"latitude":"10.8107","longitude":"52.8439"},"message":"success","timestamp":1649264191}` + "\n"
741 got, err := script.Echo(input).JQ(".").String()
742 if err != nil {
743 t.Fatal(err)
744 }
745 if want != got {
746 t.Error(cmp.Diff(want, got))
747 }
748}
749
750func TestJQWithFieldQueryProducesSelectedField(t *testing.T) {
751 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…