Skip to content

Commit

Permalink
test_parser: test escaped, unterminated quoted string, lowercase hex
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Sep 21, 2018
1 parent 687b5f0 commit a2963e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,19 @@ 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


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():
Expand Down Expand Up @@ -215,6 +220,7 @@ def test_parse_plist_dict_invalid():
("<AA>", b"\xaa"),
("<B1B0AFBA>", b"\xb1\xb0\xaf\xba"),
("<AA BB>", b"\xaa\xbb"),
("<cdef>", b"\xcd\xef"),
("<4142\n4344>", b"ABCD"),
],
)
Expand Down

0 comments on commit a2963e1

Please sign in to comment.