| 1 |
import pytest |
| 2 |
from pypy.module._multibytecodec import c_codecs |
| 3 |
from rpython.translator.c.test import test_standalone |
| 4 |
from rpython.config.translationoption import get_combined_translation_config |
| 5 |
from rpython.rlib import rutf8 |
| 6 |
|
| 7 |
|
| 8 |
@pytest.mark.skip(reason="Requires space emulation") |
| 9 |
class TestTranslation(test_standalone.StandaloneTests): |
| 10 |
config = get_combined_translation_config(translating=True) |
| 11 |
config.translation.gc = 'boehm' |
| 12 |
|
| 13 |
def test_translation(self): |
| 14 |
|
| 15 |
def entry_point(argv): |
| 16 |
codecname, string = argv[1], argv[2] |
| 17 |
c = c_codecs.getcodec(codecname) |
| 18 |
u = c_codecs.decode(space, c, string) |
| 19 |
lgt = rutf8.codepoints_in_utf8(u) |
| 20 |
r = c_codecs.encode(space, c, u, lgt) |
| 21 |
print r |
| 22 |
return 0 |
| 23 |
|
| 24 |
t, cbuilder = self.compile(entry_point) |
| 25 |
cmd = 'hz "~{abc}"' |
| 26 |
data = cbuilder.cmdexec(cmd) |
| 27 |
assert data == '~{abc}~}\n' |