diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 11:25:11 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:53 +0200 |
commit | ee0451103e6535582084c4665eff907c515d7362 (patch) | |
tree | 54a15cd73676b467213c0ed79c711c590d3a0c68 | |
parent | 04955bb9f5daf898e12db11fe950aabb544cff6c (diff) |
Use do_run_from_file() for test_longjmp_exc
-rw-r--r-- | tests/core/test_longjmp_exc.in | 28 | ||||
-rw-r--r-- | tests/core/test_longjmp_exc.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 31 |
3 files changed, 32 insertions, 28 deletions
diff --git a/tests/core/test_longjmp_exc.in b/tests/core/test_longjmp_exc.in new file mode 100644 index 00000000..3fc07b85 --- /dev/null +++ b/tests/core/test_longjmp_exc.in @@ -0,0 +1,28 @@ + + #include <stdlib.h> + #include <stdio.h> + #include <setjmp.h> + #include <emscripten.h> + + jmp_buf abortframe; + + void dostuff(int a) { + printf("pre\n"); + if (a != 42) emscripten_run_script("waka_waka()"); // this should fail, and never reach "never" + printf("never\n"); + + if (a == 100) { + longjmp (abortframe, -1); + } + + if (setjmp(abortframe)) { + printf("got 100"); + } + } + + int main(int argc, char **argv) { + dostuff(argc); + exit(1); + return 1; + } +
\ No newline at end of file diff --git a/tests/core/test_longjmp_exc.out b/tests/core/test_longjmp_exc.out new file mode 100644 index 00000000..b12dbd82 --- /dev/null +++ b/tests/core/test_longjmp_exc.out @@ -0,0 +1 @@ +waka_waka
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 07edda55..17c1dffe 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1131,35 +1131,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co def test_longjmp_exc(self): - src = r''' - #include <stdlib.h> - #include <stdio.h> - #include <setjmp.h> - #include <emscripten.h> - - jmp_buf abortframe; - - void dostuff(int a) { - printf("pre\n"); - if (a != 42) emscripten_run_script("waka_waka()"); // this should fail, and never reach "never" - printf("never\n"); - - if (a == 100) { - longjmp (abortframe, -1); - } - - if (setjmp(abortframe)) { - printf("got 100"); - } - } + test_path = path_from_root('tests', 'core', 'test_longjmp_exc') + src, output = (test_path + s for s in ('.in', '.out')) - int main(int argc, char **argv) { - dostuff(argc); - exit(1); - return 1; - } - ''' - self.do_run(src, 'waka_waka'); + self.do_run_from_file(src, output) def test_setjmp_many(self): src = r''' |