packer-cn/builder/parallels/common/prlctl_config_test.go
Adrien Delorme c11ef90cb6 use interpolate.NewContext() instead of testConfigTemplate(t)
because it's what's happenning there
2019-06-14 12:17:28 +02:00

40 lines
717 B
Go

package common
import (
"reflect"
"testing"
"github.com/hashicorp/packer/template/interpolate"
)
func TestPrlctlConfigPrepare_Prlctl(t *testing.T) {
// Test with empty
c := new(PrlctlConfig)
errs := c.Prepare(interpolate.NewContext())
if len(errs) > 0 {
t.Fatalf("err: %#v", errs)
}
if !reflect.DeepEqual(c.Prlctl, [][]string{}) {
t.Fatalf("bad: %#v", c.Prlctl)
}
// Test with a good one
c = new(PrlctlConfig)
c.Prlctl = [][]string{
{"foo", "bar", "baz"},
}
errs = c.Prepare(interpolate.NewContext())
if len(errs) > 0 {
t.Fatalf("err: %#v", errs)
}
expected := [][]string{
{"foo", "bar", "baz"},
}
if !reflect.DeepEqual(c.Prlctl, expected) {
t.Fatalf("bad: %#v", c.Prlctl)
}
}