fix: prevent crash with unicode emoji (e.g. 🏠) (#78)

* fix: prevent crash with unicode emoji (e.g. 🏠)
This commit is contained in:
Robin 2024-05-30 01:08:29 +02:00 committed by GitHub
parent 1a3f8193ff
commit a237026520
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -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')