mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-24 00:26:08 +00:00
PICARD-2214: Fix exception if script ends with backslash
This commit is contained in:
@@ -321,6 +321,8 @@ Grammar:
|
||||
text.append(chr(int(codepoint, 16)))
|
||||
except (TypeError, ValueError):
|
||||
self.__raise_unicode(codepoint)
|
||||
elif ch is None:
|
||||
self.__raise_eof()
|
||||
elif ch not in "$%(),\\":
|
||||
self.__raise_char(ch)
|
||||
else:
|
||||
|
||||
@@ -1010,6 +1010,12 @@ class ScriptParserTest(PicardTestCase):
|
||||
def test_char_escape(self):
|
||||
self.assertScriptResultEquals(r"\n\t\$\%\(\)\,\\", "\n\t$%(),\\")
|
||||
|
||||
def test_char_escape_unexpected_char(self):
|
||||
self.assertRaises(ScriptSyntaxError, self.parser.eval, r'\x')
|
||||
|
||||
def test_char_escape_end_of_file(self):
|
||||
self.assertRaises(ScriptEndOfFile, self.parser.eval, 'foo\\')
|
||||
|
||||
def test_raise_unknown_function(self):
|
||||
self.assertRaises(ScriptUnknownFunction, self.parser.eval, '$unknownfn()')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user