MCPcopy Index your code
hub / github.com/bootdotdev/bootdev / prettyPrintStdoutJqTest

Function prettyPrintStdoutJqTest

checks/jq.go:14–27  ·  view source on GitHub ↗
(test api.StdoutJqTest, variables map[string]string)

Source from the content-addressed store, hash-verified

12)
13
14func prettyPrintStdoutJqTest(test api.StdoutJqTest, variables map[string]string) string {
15 queryText := InterpolateVariables(test.Query, variables)
16 var str strings.Builder
17 fmt.Fprintf(&str, "Expect jq query '%s' to yield values satisfying:", queryText)
18 if len(test.ExpectedResults) == 0 {
19 str.WriteString("\n - [no expected results provided]")
20 return str.String()
21 }
22 for _, expected := range test.ExpectedResults {
23 value := formatJqExpectedValue(expected, variables)
24 fmt.Fprintf(&str, "\n - %s %s %s", expected.Type, expected.Operator, value)
25 }
26 return str.String()
27}
28
29func formatJqExpectedValue(expected api.JqExpectedResult, variables map[string]string) string {
30 value := expected.Value

Callers 1

prettyPrintCLICommandFunction · 0.85

Calls 2

InterpolateVariablesFunction · 0.85
formatJqExpectedValueFunction · 0.85

Tested by

no test coverage detected