This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
summer-utils/utils/quoted-string_test.go

16 lines
764 B
Go

package utils
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestQuotedStringToArray(t *testing.T) {
assert.Equal(t, []string{"hello", "world"}, QuotedStringToArray("hello world"))
assert.Equal(t, []string{"hello world"}, QuotedStringToArray("\"hello world\""))
assert.Equal(t, []string{"test", "hello world", "message"}, QuotedStringToArray("test \"hello world\" message"))
assert.Equal(t, []string{"test", "hello world \"with extra data\" inside", "message"}, QuotedStringToArray("test \"hello world \\\"with extra data\\\" inside\" message"))
assert.Equal(t, []string{"hello world"}, QuotedStringToArray("hello\\ world"))
assert.Equal(t, []string{"test", "hello world", "message"}, QuotedStringToArray("test hello\\ world message"))
}