From aa177de54bb62c1097d152153b60658f5c954ee4 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Tue, 20 Dec 2016 17:51:47 -0800 Subject: [PATCH] add test for #4247 --- .../common/step_type_boot_command_test.go | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 builder/virtualbox/common/step_type_boot_command_test.go diff --git a/builder/virtualbox/common/step_type_boot_command_test.go b/builder/virtualbox/common/step_type_boot_command_test.go new file mode 100644 index 000000000..bfb7b1729 --- /dev/null +++ b/builder/virtualbox/common/step_type_boot_command_test.go @@ -0,0 +1,29 @@ +package common + +import ( + "reflect" + "testing" +) + +func TestStepTypeBootCommand_gather(t *testing.T) { + input := [][]string{ + {"02", "82", "wait1", "03", "83"}, + {"02", "82", "03", "83"}, + {"wait5", "wait1", "wait10"}, + {"wait5", "02", "82", "03", "83", "wait1", "wait10"}, + } + + expected := [][]string{ + {"02 82", "wait1", "03 83"}, + {"02 82 03 83"}, + {"wait5", "wait1", "wait10"}, + {"wait5", "02 82 03 83", "wait1", "wait10"}, + } + + for i, data := range input { + if !reflect.DeepEqual(gathercodes(data), expected[i]) { + t.Fatalf("%#v did not equal expected %#v", data, expected[i]) + } + } + +}