(t *testing.T)
| 26 | } |
| 27 | |
| 28 | func TestPlatformShellCommand(t *testing.T) { |
| 29 | tests := []struct { |
| 30 | goos string |
| 31 | wantCommand string |
| 32 | wantArgs []string |
| 33 | }{ |
| 34 | {goos: "linux", wantCommand: "/bin/sh", wantArgs: []string{"-c", "first\nsecond"}}, |
| 35 | {goos: "windows", wantCommand: "cmd.exe", wantArgs: []string{"/D", "/S", "/C", "first\nsecond"}}, |
| 36 | } |
| 37 | for _, tt := range tests { |
| 38 | t.Run(tt.goos, func(t *testing.T) { |
| 39 | command, args := platformShellCommand(tt.goos, "first\nsecond") |
| 40 | if command != tt.wantCommand || !reflect.DeepEqual(args, tt.wantArgs) { |
| 41 | t.Fatalf("unexpected command: %q %#v", command, args) |
| 42 | } |
| 43 | }) |
| 44 | } |
| 45 | } |
nothing calls this directly
no test coverage detected