|
@@ -4,9 +4,9 @@ package dockerfile
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
-func TestNormaliseWorkdir(t *testing.T) {
|
|
|
+func TestNormalizeWorkdir(t *testing.T) {
|
|
|
tests := []struct{ platform, current, requested, expected, etext string }{
|
|
|
- {"windows", ``, ``, ``, `cannot normalise nothing`},
|
|
|
+ {"windows", ``, ``, ``, `cannot normalize nothing`},
|
|
|
{"windows", ``, `C:`, ``, `C:. is not a directory. If you are specifying a drive letter, please add a trailing '\'`},
|
|
|
{"windows", ``, `C:.`, ``, `C:. is not a directory. If you are specifying a drive letter, please add a trailing '\'`},
|
|
|
{"windows", `c:`, `\a`, ``, `c:. is not a directory. If you are specifying a drive letter, please add a trailing '\'`},
|
|
@@ -21,7 +21,7 @@ func TestNormaliseWorkdir(t *testing.T) {
|
|
|
{"windows", `C:\foo`, `bar`, `C:\foo\bar`, ``},
|
|
|
{"windows", `C:\foo`, `/bar`, `C:\bar`, ``},
|
|
|
{"windows", `C:\foo`, `\bar`, `C:\bar`, ``},
|
|
|
- {"linux", ``, ``, ``, `cannot normalise nothing`},
|
|
|
+ {"linux", ``, ``, ``, `cannot normalize nothing`},
|
|
|
{"linux", ``, `foo`, `/foo`, ``},
|
|
|
{"linux", ``, `/foo`, `/foo`, ``},
|
|
|
{"linux", `/foo`, `bar`, `/foo/bar`, ``},
|
|
@@ -29,18 +29,18 @@ func TestNormaliseWorkdir(t *testing.T) {
|
|
|
{"linux", `\a`, `b\c`, `/a/b/c`, ``},
|
|
|
}
|
|
|
for _, i := range tests {
|
|
|
- r, e := normaliseWorkdir(i.platform, i.current, i.requested)
|
|
|
+ r, e := normalizeWorkdir(i.platform, i.current, i.requested)
|
|
|
|
|
|
if i.etext != "" && e == nil {
|
|
|
- t.Fatalf("TestNormaliseWorkingDir Expected error %s for '%s' '%s', got no error", i.etext, i.current, i.requested)
|
|
|
+ t.Fatalf("TestNormalizeWorkingDir Expected error %s for '%s' '%s', got no error", i.etext, i.current, i.requested)
|
|
|
}
|
|
|
|
|
|
if i.etext != "" && e.Error() != i.etext {
|
|
|
- t.Fatalf("TestNormaliseWorkingDir Expected error %s for '%s' '%s', got %s", i.etext, i.current, i.requested, e.Error())
|
|
|
+ t.Fatalf("TestNormalizeWorkingDir Expected error %s for '%s' '%s', got %s", i.etext, i.current, i.requested, e.Error())
|
|
|
}
|
|
|
|
|
|
if r != i.expected {
|
|
|
- t.Fatalf("TestNormaliseWorkingDir Expected '%s' for '%s' '%s', got '%s'", i.expected, i.current, i.requested, r)
|
|
|
+ t.Fatalf("TestNormalizeWorkingDir Expected '%s' for '%s' '%s', got '%s'", i.expected, i.current, i.requested, r)
|
|
|
}
|
|
|
}
|
|
|
}
|