TestCommandDoesNotMutateOptions verifies that passing opts to Command() does not overwrite the tool's stored Options for subsequent calls.
(t *testing.T)
| 12 | // TestCommandDoesNotMutateOptions verifies that passing opts to Command() does not |
| 13 | // overwrite the tool's stored Options for subsequent calls. |
| 14 | func 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 | } |
nothing calls this directly
no test coverage detected