-
Notifications
You must be signed in to change notification settings - Fork 0
/
escapeparser_test.go
42 lines (29 loc) · 1 KB
/
escapeparser_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package escaper
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestParser(t *testing.T) {
parsed := Parse("foo bar biz")
assert.Equal(t, []string{"foo", "bar", "biz"}, parsed)
}
func TestParserEscaped(t *testing.T) {
parsed := Parse("foo \"bar\" biz")
assert.Equal(t, []string{"foo", "bar", "biz"}, parsed)
}
func TestParserEscapedWithSpaces(t *testing.T) {
parsed := Parse("foo \"test me!\" biz")
assert.Equal(t, []string{"foo", "test me!", "biz"}, parsed)
}
func TestParserEscapedWithEndingEscapes(t *testing.T) {
parsed := Parse("foo \"test me! biz\"")
assert.Equal(t, []string{"foo", "test me! biz"}, parsed)
}
func TestParserEscapedWithQuotesInEscaped(t *testing.T) {
parsed := Parse("foo \"test \\\"me!\\\" biz\"")
assert.Equal(t, []string{"foo", "test \\\"me!\\\" biz"}, parsed)
}
func TestParserEscapedWithQuotesInEscapedMultipleSpaces(t *testing.T) {
parsed := Parse("foo \"test \\\"me!\\\" biz\" ")
assert.Equal(t, []string{"foo", "test \\\"me!\\\" biz"}, parsed)
}