package utils import ( "github.com/stretchr/testify/assert" "testing" ) func TestParseKeyValueString(t *testing.T) { assert.Nil(t, ParseKeyValueString("hello world")) assert.Equal(t, &KeyValuePair{"hello", "world"}, ParseKeyValueString("hello=world")) } func TestParseKeyValueFromStringArray(t *testing.T) { assert.Equal(t, []KeyValuePair{}, ParseKeyValueFromStringArray([]string{})) assert.Equal(t, []KeyValuePair{}, ParseKeyValueFromStringArray([]string{"hello world"})) assert.Equal(t, []KeyValuePair{{"hello", "world"}}, ParseKeyValueFromStringArray([]string{"hello=world"})) assert.Equal(t, []KeyValuePair{{"hello", "world"}}, ParseKeyValueFromStringArray([]string{"hello=world", "test"})) assert.Equal(t, []KeyValuePair{{"hello", "world"}, {"test", "1"}}, ParseKeyValueFromStringArray([]string{"hello=world", "test=1"})) }