1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-07 04:27:18 +00:00

Bot: Handle iphone style quotes (#182)

This commit is contained in:
Dan Anstis 2021-01-15 10:23:14 +10:00 committed by GitHub
parent de3049b730
commit da3f728ed4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -76,7 +76,7 @@ func Parse(line string) ([]string, error) {
} }
switch r { switch r {
case '"': case '"', '“', '”':
if !singleQuoted { if !singleQuoted {
if doubleQuoted { if doubleQuoted {
got = true got = true
@ -84,7 +84,7 @@ func Parse(line string) ([]string, error) {
doubleQuoted = !doubleQuoted doubleQuoted = !doubleQuoted
continue continue
} }
case '\'', '`': case '\'', '`', '', '':
if !doubleQuoted { if !doubleQuoted {
if singleQuoted { if singleQuoted {
got = true got = true

View file

@ -58,6 +58,16 @@ func TestParse(t *testing.T) {
[]string{"this", "should", "not", "crash"}, []string{"this", "should", "not", "crash"},
true, true,
}, },
{
"iPhone “double quoted” text",
[]string{"iPhone", "double quoted", "text"},
true,
},
{
"iPhone single quoted text",
[]string{"iPhone", "single quoted", "text"},
true,
},
} }
for _, test := range tests { for _, test := range tests {