Merge pull request #1106 from mostynb/windows_drive_letter

Don't assume a fixed windows drive letter in tests
This commit is contained in:
Robert Liebowitz 2020-04-14 06:33:23 -04:00 committed by GitHub
commit 3e069af0ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"path/filepath"
"runtime" "runtime"
"strings" "strings"
"testing" "testing"
@ -190,7 +191,13 @@ func TestPathApplyInputSourceMethodSet(t *testing.T) {
expected := "/path/to/source/hello" expected := "/path/to/source/hello"
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
expected = `D:\path\to\source\hello` var err error
// Prepend the corresponding drive letter (or UNC path?), and change
// to windows-style path:
expected, err = filepath.Abs(expected)
if err != nil {
t.Fatal(err)
}
} }
expect(t, expected, c.String("test")) expect(t, expected, c.String("test"))
} }