mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Split Windows and Unix specific path tests
This commit is contained in:
27
helpers/path_unix_test.go
Normal file
27
helpers/path_unix_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// +build !windows
|
||||
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPlatformAbsPathify(t *testing.T) {
|
||||
type test struct {
|
||||
inPath, workingDir, expected string
|
||||
}
|
||||
data := []test{
|
||||
{"/banana/../dir/", "/work", "/dir"},
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
// todo see comment in AbsPathify
|
||||
viper.Set("WorkingDir", d.workingDir)
|
||||
|
||||
expected := AbsPathify(d.inPath)
|
||||
if d.expected != expected {
|
||||
t.Errorf("Test %d failed. Expected %q but got %q", i, d.expected, expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user