16 lines
764 B
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"))
|
|
}
|