github.com/hashicorp/packer@v1.14.3/fix/fixer_vmware_rename_test.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package fix 5 6 import ( 7 "reflect" 8 "testing" 9 ) 10 11 func TestFixerVMwareRename_impl(t *testing.T) { 12 var _ Fixer = new(FixerVMwareRename) 13 } 14 15 func TestFixerVMwareRename_Fix(t *testing.T) { 16 cases := []struct { 17 Input map[string]interface{} 18 Expected map[string]interface{} 19 }{ 20 { 21 Input: map[string]interface{}{ 22 "type": "vmware", 23 }, 24 25 Expected: map[string]interface{}{ 26 "type": "vmware-iso", 27 }, 28 }, 29 } 30 31 for _, tc := range cases { 32 var f FixerVMwareRename 33 34 input := map[string]interface{}{ 35 "builders": []map[string]interface{}{tc.Input}, 36 } 37 38 expected := map[string]interface{}{ 39 "builders": []map[string]interface{}{tc.Expected}, 40 } 41 42 output, err := f.Fix(input) 43 if err != nil { 44 t.Fatalf("err: %s", err) 45 } 46 47 if !reflect.DeepEqual(output, expected) { 48 t.Fatalf("unexpected: %#v\nexpected: %#v\n", output, expected) 49 } 50 } 51 }