From 1cbfe466f0fb8c2320c54cec9e54fbdb1d5bd4ac Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Thu, 23 Nov 2017 14:37:52 +0100 Subject: Split kernel cmdline test --- libvirt/utils_domain_def_test.go | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'libvirt') diff --git a/libvirt/utils_domain_def_test.go b/libvirt/utils_domain_def_test.go index b497c02c..4880804e 100644 --- a/libvirt/utils_domain_def_test.go +++ b/libvirt/utils_domain_def_test.go @@ -12,25 +12,23 @@ func init() { } func TestSplitKernelCmdLine(t *testing.T) { - { - e := []map[string]string{{"foo": "bar"}, {"foo": "bar", "key": "val"}} - r, err := splitKernelCmdLine("foo=bar foo=bar key=val") - if !reflect.DeepEqual(r, e) { - t.Fatalf("got='%s' expected='%s'", spew.Sdump(r), spew.Sdump(e)) - } - if err != nil { - t.Error(err) - } + e := []map[string]string{{"foo": "bar"}, {"foo": "bar", "key": "val"}} + r, err := splitKernelCmdLine("foo=bar foo=bar key=val") + if !reflect.DeepEqual(r, e) { + t.Fatalf("got='%s' expected='%s'", spew.Sdump(r), spew.Sdump(e)) } + if err != nil { + t.Error(err) + } +} - { - v := "foo=barfoo=bar" - r, err := splitKernelCmdLine(v) - if r != nil { - t.Fatalf("got='%s' expected='%s'", spew.Sdump(r), err) - } - if err == nil { - t.Errorf("Expected error for parsing '%s'", v) - } +func TestSplitKernelInvalidCmdLine(t *testing.T) { + v := "foo=barfoo=bar" + r, err := splitKernelCmdLine(v) + if r != nil { + t.Fatalf("got='%s' expected='%s'", spew.Sdump(r), err) + } + if err == nil { + t.Errorf("Expected error for parsing '%s'", v) } } -- cgit v1.2.3