1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-09-12 13:16:42 +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 {
case '"':
case '"', '“', '”':
if !singleQuoted {
if doubleQuoted {
got = true
@ -84,7 +84,7 @@ func Parse(line string) ([]string, error) {
doubleQuoted = !doubleQuoted
continue
}
case '\'', '`':
case '\'', '`', '', '':
if !doubleQuoted {
if singleQuoted {
got = true

View file

@ -58,6 +58,16 @@ func TestParse(t *testing.T) {
[]string{"this", "should", "not", "crash"},
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 {