MCPcopy
hub / github.com/TomWright/dasel / runTest

Function runTest

internal/cli/command_test.go:38–61  ·  view source on GitHub ↗
(tc testCase)

Source from the content-addressed store, hash-verified

36}
37
38func runTest(tc testCase) func(t *testing.T) {
39 return func(t *testing.T) {
40 if tc.stdout == nil {
41 tc.stdout = []byte{}
42 }
43 if tc.stderr == nil {
44 tc.stderr = []byte{}
45 }
46
47 gotStdOut, gotStdErr, gotErr := runDasel(tc.args, tc.in)
48 if !errors.Is(gotErr, tc.err) && !errors.Is(tc.err, gotErr) {
49 t.Errorf("expected error %v, got %v", tc.err, gotErr)
50 return
51 }
52
53 if !reflect.DeepEqual(tc.stderr, gotStdErr) {
54 t.Errorf("expected stderr %s, got %s", string(tc.stderr), string(gotStdErr))
55 }
56
57 if !reflect.DeepEqual(tc.stdout, gotStdOut) {
58 t.Errorf("expected stdout %s, got %s", string(tc.stdout), string(gotStdOut))
59 }
60 }
61}
62
63func TestRun(t *testing.T) {
64 t.Run("complex set", func(t *testing.T) {

Callers 2

runMethod · 0.85
TestRunFunction · 0.85

Calls 1

runDaselFunction · 0.85

Tested by

no test coverage detected