Merge pull request #1106 from mostynb/windows_drive_letter
Don't assume a fixed windows drive letter in tests
This commit is contained in:
commit
3e069af0ca
@ -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"))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user