diff --git a/qemu_test.go b/qemu_test.go index a86b193b7..3e38ca59c 100644 --- a/qemu_test.go +++ b/qemu_test.go @@ -46,6 +46,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) { } params = appendObjects([]string{}, config) + + case Knobs: + config := Config{ + Knobs: s, + } + + params = appendKnobs([]string{}, config) } result := strings.Join(params, " ") @@ -119,3 +126,25 @@ func TestAppendEmptyObject(t *testing.T) { testAppend(device, "", t) } + +var knobsString = "-no-user-config -nodefaults -nographic" + +func TestAppendKnobsAllTrue(t *testing.T) { + knobs := Knobs{ + NoUserConfig: true, + NoDefaults: true, + NoGraphic: true, + } + + testAppend(knobs, knobsString, t) +} + +func TestAppendKnobsAllFalse(t *testing.T) { + knobs := Knobs{ + NoUserConfig: false, + NoDefaults: false, + NoGraphic: false, + } + + testAppend(knobs, "", t) +}