From a237026520f80861751ff41cc15b3ad35766c3ad Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 30 May 2024 01:08:29 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20prevent=20crash=20with=20unicode=20emoji?= =?UTF-8?q?=20(e.g.=20=F0=9F=8F=A0)=20(#78)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: prevent crash with unicode emoji (e.g. 🏠) --- tests/test_evaljs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_evaljs.py b/tests/test_evaljs.py index 36dd30f..3b4631d 100644 --- a/tests/test_evaljs.py +++ b/tests/test_evaljs.py @@ -30,8 +30,14 @@ class TestEvalJS(unittest.TestCase): assert s == 'čŊčŊ' def test_unicode_emoji(self): - s = dukpy.evaljs("dukpy.c + 'čŊ'", c="🏠") - assert s == '🏠čŊ' + s1 = dukpy.evaljs("dukpy.c + 'B'", c="🏠") + assert s1 == '🏠B' + + s2 = dukpy.evaljs("dukpy.c + 'C'", c="👍ðŸū") + assert s2 == '👍ðŸūC' + + s3 = dukpy.evaljs("dukpy.c + 'čŊ'", c="🏠") + assert s3 == '🏠čŊ' def test_eval_files(self): testfile = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'test.js')