MCPcopy
hub / github.com/lima-vm/lima / TestCommandDoesNotMutateOptions

Function TestCommandDoesNotMutateOptions

pkg/copytool/copytool_test.go:14–27  ·  view source on GitHub ↗

TestCommandDoesNotMutateOptions verifies that passing opts to Command() does not overwrite the tool's stored Options for subsequent calls.

(t *testing.T)

Source from the content-addressed store, hash-verified

12// TestCommandDoesNotMutateOptions verifies that passing opts to Command() does not
13// overwrite the tool's stored Options for subsequent calls.
14func TestCommandDoesNotMutateOptions(t *testing.T) {
15 initial := &Options{Verbose: false, Recursive: false}
16 tool, err := newRsyncTool(initial)
17 if err != nil {
18 t.Skip("rsync not found:", err)
19 }
20
21 override := &Options{Verbose: true, Recursive: true}
22 // Use local paths to avoid instance lookup
23 _, _ = tool.Command(t.Context(), []string{"/tmp/src", "/tmp/dst"}, override)
24
25 assert.Equal(t, tool.Options.Verbose, false, "Command() must not mutate stored Options.Verbose")
26 assert.Equal(t, tool.Options.Recursive, false, "Command() must not mutate stored Options.Recursive")
27}

Callers

nothing calls this directly

Calls 2

newRsyncToolFunction · 0.85
CommandMethod · 0.65

Tested by

no test coverage detected