2014-03-12 19:14:44 -04:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestVBoxManagePostConfigPrepare_VBoxManage(t *testing.T) {
|
|
|
|
// Test with empty
|
|
|
|
c := new(VBoxManagePostConfig)
|
|
|
|
errs := c.Prepare(testConfigTemplate(t))
|
|
|
|
if len(errs) > 0 {
|
|
|
|
t.Fatalf("err: %#v", errs)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(c.VBoxManagePost, [][]string{}) {
|
|
|
|
t.Fatalf("bad: %#v", c.VBoxManagePost)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test with a good one
|
|
|
|
c = new(VBoxManagePostConfig)
|
|
|
|
c.VBoxManagePost = [][]string{
|
|
|
|
{"foo", "bar", "baz"},
|
|
|
|
}
|
|
|
|
errs = c.Prepare(testConfigTemplate(t))
|
|
|
|
if len(errs) > 0 {
|
|
|
|
t.Fatalf("err: %#v", errs)
|
|
|
|
}
|
|
|
|
|
|
|
|
expected := [][]string{
|
2016-11-01 17:08:04 -04:00
|
|
|
{"foo", "bar", "baz"},
|
2014-03-12 19:14:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(c.VBoxManagePost, expected) {
|
|
|
|
t.Fatalf("bad: %#v", c.VBoxManagePost)
|
|
|
|
}
|
|
|
|
}
|