Skip to content

Commit

Permalink
Fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl committed Feb 3, 2021
1 parent 263e9c4 commit 6db4704
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,6 @@ impl<'a> Shlex<'a> {
loop {
if let Some(ch2) = self.next_char() {
match ch2 as char {
'\\' => {
if let Some(ch3) = self.next_char() {
match ch3 as char {
// for single quotes, only these can be escaped
'\'' | '\\' => { result.push(ch3); },
_ => { result.push('\\' as u8); result.push(ch3); }
}
} else {
return Err(());
}
},
'\'' => { return Ok(()); },
_ => { result.push(ch2); },
}
Expand Down Expand Up @@ -200,7 +189,7 @@ static SPLIT_TEST_ITEMS: &'static [(&'static str, Option<&'static [&'static str]
("foo\\\nbar", Some(&["foobar"])),
("\"foo\\\nbar\"", Some(&["foobar"])),
("'baz\\$b'", Some(&["baz\\$b"])),
("'baz\\\''", Some(&["baz\'"])),
("'baz\\\''", None),
("\\", None),
("\"\\", None),
("'\\", None),
Expand All @@ -210,6 +199,8 @@ static SPLIT_TEST_ITEMS: &'static [(&'static str, Option<&'static [&'static str]
("foo #bar", Some(&["foo"])),
("foo#bar", Some(&["foo#bar"])),
("foo\"#bar", None),
("'\\n'", Some(&["\\n"])),
("'\\\\n'", Some(&["\\\\n"])),
];

#[test]
Expand Down

0 comments on commit 6db4704

Please sign in to comment.