github.com/sneal/packer@v0.5.2/builder/vmware/common/driver_config_test.go (about)

     1  package common
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestDriverConfigPrepare(t *testing.T) {
     8  	var c *DriverConfig
     9  
    10  	// Test a default boot_wait
    11  	c = new(DriverConfig)
    12  	errs := c.Prepare(testConfigTemplate(t))
    13  	if len(errs) > 0 {
    14  		t.Fatalf("bad: %#v", errs)
    15  	}
    16  	if c.FusionAppPath != "/Applications/VMware Fusion.app" {
    17  		t.Fatalf("bad value: %s", c.FusionAppPath)
    18  	}
    19  
    20  	// Test with a good one
    21  	c = new(DriverConfig)
    22  	c.FusionAppPath = "foo"
    23  	errs = c.Prepare(testConfigTemplate(t))
    24  	if len(errs) > 0 {
    25  		t.Fatalf("bad: %#v", errs)
    26  	}
    27  	if c.FusionAppPath != "foo" {
    28  		t.Fatalf("bad value: %s", c.FusionAppPath)
    29  	}
    30  }