github.phpd.cn/hashicorp/packer@v1.3.2/builder/parallels/common/prlctl_post_config_test.go (about) 1 package common 2 3 import ( 4 "reflect" 5 "testing" 6 ) 7 8 func TestPrlctlPostConfigPrepare_PrlctlPost(t *testing.T) { 9 // Test with empty 10 c := new(PrlctlPostConfig) 11 errs := c.Prepare(testConfigTemplate(t)) 12 if len(errs) > 0 { 13 t.Fatalf("err: %#v", errs) 14 } 15 16 if !reflect.DeepEqual(c.PrlctlPost, [][]string{}) { 17 t.Fatalf("bad: %#v", c.PrlctlPost) 18 } 19 20 // Test with a good one 21 c = new(PrlctlPostConfig) 22 c.PrlctlPost = [][]string{ 23 {"foo", "bar", "baz"}, 24 } 25 errs = c.Prepare(testConfigTemplate(t)) 26 if len(errs) > 0 { 27 t.Fatalf("err: %#v", errs) 28 } 29 30 expected := [][]string{ 31 {"foo", "bar", "baz"}, 32 } 33 34 if !reflect.DeepEqual(c.PrlctlPost, expected) { 35 t.Fatalf("bad: %#v", c.PrlctlPost) 36 } 37 }