From a2963e112d8b7a90c782ad481f52ff7a67b45065 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Fri, 21 Sep 2018 18:56:58 +0100 Subject: [PATCH] test_parser: test escaped, unterminated quoted string, lowercase hex --- tests/test_parser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_parser.py b/tests/test_parser.py index ee6ab8d..4be00b9 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -129,7 +129,10 @@ def test_parse_unquoted_plist_string_EOF(): parse_unquoted_plist_string("") == expected -@pytest.mark.parametrize("string, expected", [("a", "a"), ('"a"', "a"), ("'a'", "a")]) +@pytest.mark.parametrize( + "string, expected", + [("a", "a"), ('"a"', "a"), ("'a'", "a"), ('"a\\012b"', ("a\nb"))], +) def test_parse_plist_string(string, expected): assert parse_plist_string(string) == expected @@ -137,6 +140,8 @@ def test_parse_plist_string(string, expected): def test_parse_plist_string_EOF(): with pytest.raises(openstep_plist.ParseError, match="Unexpected EOF"): parse_plist_string("") + with pytest.raises(openstep_plist.ParseError, match="Unterminated quoted string"): + parse_plist_string("'a") def test_parse_plist_string_invalid_char(): @@ -215,6 +220,7 @@ def test_parse_plist_dict_invalid(): ("", b"\xaa"), ("", b"\xb1\xb0\xaf\xba"), ("", b"\xaa\xbb"), + ("", b"\xcd\xef"), ("<4142\n4344>", b"ABCD"), ], )