diff options
Diffstat (limited to 'src/os/exec/lp_windows_test.go')
| -rw-r--r-- | src/os/exec/lp_windows_test.go | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/os/exec/lp_windows_test.go b/src/os/exec/lp_windows_test.go index f2c56ccce4..6e7615fd44 100644 --- a/src/os/exec/lp_windows_test.go +++ b/src/os/exec/lp_windows_test.go @@ -554,14 +554,8 @@ func TestCommand(t *testing.T) { if wantPath == "" { if strings.Contains(tt.arg0, `\`) { wantPath = tt.arg0 - if filepath.Ext(wantPath) == "" { - wantPath += filepath.Ext(tt.want) - } } else if tt.wantErrDot { wantPath = strings.TrimPrefix(tt.want, tt.dir+`\`) - if filepath.Base(wantPath) == wantPath { - wantPath = `.\` + wantPath - } } else { wantPath = filepath.Join(root, tt.want) } @@ -572,3 +566,26 @@ func TestCommand(t *testing.T) { }) } } + +func TestAbsCommandWithDoubledExtension(t *testing.T) { + t.Parallel() + + comPath := filepath.Join(t.TempDir(), "example.com") + batPath := comPath + ".bat" + installBat(t, batPath) + + cmd := exec.Command(comPath) + out, err := cmd.CombinedOutput() + t.Logf("%v:\n%s", cmd, out) + if err == nil { + got := strings.TrimSpace(string(out)) + if got != batPath { + t.Errorf("wanted output %#q", batPath) + } + } else { + t.Errorf("%v: %v", cmd, err) + } + if cmd.Path != batPath { + t.Errorf("exec.Command(%#q).Path =\n %#q\nwant %#q", comPath, cmd.Path, batPath) + } +} |
