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:
parent
de3049b730
commit
da3f728ed4
|
@ -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
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue