<commit_before>package libvirt

import (
	"reflect"
	"testing"

	"github.com/davecgh/go-spew/spew"
)

func init() {
	spew.Config.Indent = "\t"
}

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)
		}
	}

	{
		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)
		}
	}
}<commit_msg>Split kernel cmdline test<commit_after>package libvirt

import (
	"reflect"
	"testing"

	"github.com/davecgh/go-spew/spew"
)

func init() {
	spew.Config.Indent = "\t"
}

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)
	}
}

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)
	}
}
{'fraction_non_alphanumeric': 0.2194269741439553, 'fraction_numerical': 0.0, 'mean_word_length': 4.078014184397163, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4502673', 'n_tokens_mistral': 645, 'n_tokens_neox': 624, 'n_words': 120}