Skip to content

Commit

Permalink
update & fix testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
laktak committed Oct 27, 2017
1 parent 64e7616 commit 9aa5fb1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hjson/encoderH.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 10,7 @@

# This is required because u() will mangle the string and ur'' isn't valid
# python3 syntax
ESCAPE = re.compile(u'[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t\u2028\u2029]')
ESCAPE = re.compile(u'[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t\u2028\u2029\uffff]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
Expand All @@ -25,7 25,7 @@
for i in range(0x20):
#ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
ESCAPE_DCT.setdefault(chr(i), '\\ux' % (i,))
for i in [0x2028, 0x2029]:
for i in [0x2028, 0x2029, 0xffff]:
ESCAPE_DCT.setdefault(unichr(i), '\\ux' % (i,))

COMMONRANGE=u'\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff'
Expand Down
8 changes: 8 additions & 0 deletions hjson/tests/assets/charset2_result.hjson
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
{
uescape: "\u0000,\u0001,\uffff"
French: ° î â ê Î Â Ê é É è à ù È À Ù ë Ë ç Ç œ « »
German: ä Ä ö Ö ü Ü ß
Italian: ° é ç à è ì ò ù À È Ì Ò Ù
Spanish: ñ Ñ ü Ü á é í ó ú Á É Í Ó Ú º ¿ ¡
hex: ģ䕧覫췯ꯍ
}
8 changes: 8 additions & 0 deletions hjson/tests/assets/charset2_result.json
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
{
"uescape": "\u0000,\u0001,￿",
"French": "° î â ê Î Â Ê é É è à ù È À Ù ë Ë ç Ç œ « »",
"German": "ä Ä ö Ö ü Ü ß",
"Italian": "° é ç à è ì ò ù À È Ì Ò Ù",
"Spanish": "ñ Ñ ü Ü á é í ó ú Á É Í Ó Ú º ¿ ¡",
"hex": "ģ䕧覫췯ꯍ"
}
8 changes: 8 additions & 0 deletions hjson/tests/assets/charset2_test.hjson
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
{
uescape: "\u0000,\u0001,\uffff"
French: ° î â ê Î Â Ê é É è à ù È À Ù ë Ë ç Ç œ « »
German: ä Ä ö Ö ü Ü ß
Italian: ° é ç à è ì ò ù À È Ì Ò Ù
Spanish: ñ Ñ ü Ü á é í ó ú Á É Í Ó Ú º ¿ ¡
hex: "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A"
}
1 change: 1 addition & 0 deletions hjson/tests/assets/testlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 1,4 @@
charset2_test.hjson
charset_test.hjson
comments_test.hjson
empty_test.hjson
Expand Down

0 comments on commit 9aa5fb1

Please sign in to comment.