MCPcopy Create free account
hub / github.com/devld/go-drive / TestPlatformShellCommand

Function TestPlatformShellCommand

server/thumbnail/shell_test.go:28–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func 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}

Callers

nothing calls this directly

Calls 2

platformShellCommandFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected