The name of 'list' has been changed to 'array'; from now on, 'list' will refer to the linked list.
This commit is contained in:
+8
-28
@@ -18,34 +18,24 @@ import (
|
||||
func TestExpandPathRootOk(t *testing.T) {
|
||||
source := "~root"
|
||||
wantValue := "/root"
|
||||
// wantErr := errors.New(`test expected string, got list ([])`)
|
||||
wantErr := error(nil)
|
||||
|
||||
gotValue, gotErr := util.ExpandPath(source)
|
||||
|
||||
if gotErr != nil && gotErr.Error() != wantErr.Error() {
|
||||
if gotErr != nil || gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
} else if gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
source, gotValue, gotErr, wantValue, nil)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandPathRootSubDirOk(t *testing.T) {
|
||||
source := "~root/test"
|
||||
wantValue := "/root/test"
|
||||
// wantErr := errors.New(`test expected string, got list ([])`)
|
||||
wantErr := error(nil)
|
||||
|
||||
gotValue, gotErr := util.ExpandPath(source)
|
||||
|
||||
if gotErr != nil && gotErr.Error() != wantErr.Error() {
|
||||
if gotErr != nil || gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
} else if gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
source, gotValue, gotErr, wantValue, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,17 +43,12 @@ func TestExpandPathUser(t *testing.T) {
|
||||
u, _ := user.Current()
|
||||
source := "~"
|
||||
wantValue := path.Join("/home", u.Username)
|
||||
// wantErr := errors.New(`test expected string, got list ([])`)
|
||||
wantErr := error(nil)
|
||||
|
||||
gotValue, gotErr := util.ExpandPath(source)
|
||||
|
||||
if gotErr != nil {
|
||||
if gotErr != nil || gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
} else if gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
source, gotValue, gotErr, wantValue, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,17 +56,12 @@ func TestExpandPathEnv(t *testing.T) {
|
||||
u, _ := user.Current()
|
||||
source := "$HOME"
|
||||
wantValue := path.Join("/home", u.Username)
|
||||
// wantErr := errors.New(`test expected string, got list ([])`)
|
||||
wantErr := error(nil)
|
||||
|
||||
gotValue, gotErr := util.ExpandPath(source)
|
||||
|
||||
if gotErr != nil {
|
||||
if gotErr != nil || gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
} else if gotValue != wantValue {
|
||||
t.Errorf(`ExpandPath(%v) gotValue=%q, gotErr=%v -> wantValue=%q, wantErr=%v`,
|
||||
source, gotValue, gotErr, wantValue, wantErr)
|
||||
source, gotValue, gotErr, wantValue, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user