diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 16:29:49 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:01 +0200 |
commit | 75410f1c96a9216a2b597efec1a6128b3bc7c826 (patch) | |
tree | 48a4e40e65d4c59c977e32e8839066ef4c5d2fba | |
parent | c2ab3523375cbc7f70775954bfa738fe9ec6a07a (diff) |
Use do_run_from_file() for test_utf
-rw-r--r-- | tests/core/test_utf.in | 13 | ||||
-rw-r--r-- | tests/core/test_utf.out | 2 | ||||
-rw-r--r-- | tests/test_core.py | 16 |
3 files changed, 18 insertions, 13 deletions
diff --git a/tests/core/test_utf.in b/tests/core/test_utf.in new file mode 100644 index 00000000..29cb6eac --- /dev/null +++ b/tests/core/test_utf.in @@ -0,0 +1,13 @@ + + #include <stdio.h> + #include <emscripten.h> + + int main() { + char *c = "μ†ℱ ╋ℯ╳╋ 😇"; + printf("%d %d %d %d %s\n", c[0]&0xff, c[1]&0xff, c[2]&0xff, c[3]&0xff, c); + emscripten_run_script( + "cheez = _malloc(100);" + "Module.writeStringToMemory(\"μ†ℱ ╋ℯ╳╋ 😇\", cheez);" + "Module.print([Pointer_stringify(cheez), Module.getValue(cheez, 'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, Module.getValue(cheez+2, 'i8')&0xff, Module.getValue(cheez+3, 'i8')&0xff, ]);"); + } +
\ No newline at end of file diff --git a/tests/core/test_utf.out b/tests/core/test_utf.out new file mode 100644 index 00000000..a2af5f8b --- /dev/null +++ b/tests/core/test_utf.out @@ -0,0 +1,2 @@ +206 188 226 128 μ†ℱ ╋ℯ╳╋ 😇 +μ†ℱ ╋ℯ╳╋ 😇,206,188,226,128 diff --git a/tests/test_core.py b/tests/test_core.py index 6d72da8e..f3b036eb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4006,20 +4006,10 @@ def process(filename): self.banned_js_engines = [SPIDERMONKEY_ENGINE] # only node handles utf well Settings.EXPORTED_FUNCTIONS = ['_main', '_malloc'] - src = r''' - #include <stdio.h> - #include <emscripten.h> + test_path = path_from_root('tests', 'core', 'test_utf') + src, output = (test_path + s for s in ('.in', '.out')) - int main() { - char *c = "μ†ℱ ╋ℯ╳╋ 😇"; - printf("%d %d %d %d %s\n", c[0]&0xff, c[1]&0xff, c[2]&0xff, c[3]&0xff, c); - emscripten_run_script( - "cheez = _malloc(100);" - "Module.writeStringToMemory(\"μ†ℱ ╋ℯ╳╋ 😇\", cheez);" - "Module.print([Pointer_stringify(cheez), Module.getValue(cheez, 'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, Module.getValue(cheez+2, 'i8')&0xff, Module.getValue(cheez+3, 'i8')&0xff, ]);"); - } - ''' - self.do_run(src, '206 188 226 128 μ†ℱ ╋ℯ╳╋ 😇\nμ†ℱ ╋ℯ╳╋ 😇,206,188,226,128\n'); + self.do_run_from_file(src, output) def test_utf32(self): if self.emcc_args is None: return self.skip('need libc for wcslen()') |