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