Skip to content

Commit

Permalink
[translation] Fix build by renaming to pyj8.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Dec 25, 2023
1 parent 30e3316 commit 3f9fa6f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build/dynamic-deps.sh
Expand Up @@ -79,6 +79,8 @@ asdl/py.* # pybase.py ported by hand to C++
core/py.* # pyos.py, pyutil.py ported by hand to C++
core/optview\.py # core/optview_gen.py
data_lang/py.* # pyj8.py
frontend/py.*\.py # py_readline.py ported by hand to C++
frontend/consts.py # frontend/consts_gen.py
frontend/match.py # frontend/lexer_gen.py
Expand Down
4 changes: 2 additions & 2 deletions data_lang/j8.py
Expand Up @@ -34,13 +34,13 @@

from asdl import format as fmt
from core import vm
from data_lang import j8_str
from data_lang import pyj8
from data_lang import qsn
from mycpp import mylib
from mycpp.mylib import tagswitch, iteritems, log

_ = log
unused = j8_str
unused = pyj8

from typing import cast, Dict

Expand Down
1 change: 1 addition & 0 deletions data_lang/j8_str.py → data_lang/pyj8.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python2
from __future__ import print_function
"""
j8_str.py
"""
Expand Down
41 changes: 41 additions & 0 deletions data_lang/pyj8_test.py
@@ -0,0 +1,41 @@
#!/usr/bin/env python2
"""
pyj8_test.py: Tests for pyj8.py
"""
from __future__ import print_function

import unittest

from data_lang import pyj8 # module under test


class J8Test(unittest.TestCase):

def testEncode(self):
en = pyj8.Enc('hello', 0)
print(en)

en = pyj8.Enc('\xff-\xfe-\xff-\xfe', 0)
print(en)

# multiple errrors
en = pyj8.Enc('hello\xffthere \xfe\xff gah', 0)
print(en)

# valid mu
en = pyj8.Enc('hello \xce\xbc there', 0)
print(en)

# two first bytes - invalid
en = pyj8.Enc('hello \xce\xce there', 0)
print(en)

# two cont bytes - invalid
en = pyj8.Enc('hello \xbc\xbc there', 0)
print(en)


if __name__ == '__main__':
unittest.main()

# vim: sw=4
1 change: 1 addition & 0 deletions prebuilt/dynamic-deps/filter-translate.txt
Expand Up @@ -5,6 +5,7 @@ _gen/
asdl/py.*
core/py.*
core/optview\.py
data_lang/py.*
frontend/py.*\.py
frontend/consts.py
frontend/match.py
Expand Down

0 comments on commit 3f9fa6f

Please sign in to comment.