summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_std_exception.in15
-rw-r--r--tests/core/test_std_exception.out1
-rw-r--r--tests/test_core.py18
3 files changed, 19 insertions, 15 deletions
diff --git a/tests/core/test_std_exception.in b/tests/core/test_std_exception.in
new file mode 100644
index 00000000..280faed2
--- /dev/null
+++ b/tests/core/test_std_exception.in
@@ -0,0 +1,15 @@
+
+ #include <stdio.h>
+ #include <exception>
+
+ int main()
+ {
+ std::exception e;
+ try {
+ throw e;
+ } catch(std::exception e) {
+ printf("caught std::exception\n");
+ }
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_std_exception.out b/tests/core/test_std_exception.out
new file mode 100644
index 00000000..c1660de4
--- /dev/null
+++ b/tests/core/test_std_exception.out
@@ -0,0 +1 @@
+caught std::exception \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index c33bef18..6e378785 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1322,22 +1322,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
Settings.DISABLE_EXCEPTION_CATCHING = 0
self.emcc_args += ['-s', 'SAFE_HEAP=0']
- src = r'''
- #include <stdio.h>
- #include <exception>
+ test_path = path_from_root('tests', 'core', 'test_std_exception')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main()
- {
- std::exception e;
- try {
- throw e;
- } catch(std::exception e) {
- printf("caught std::exception\n");
- }
- return 0;
- }
- '''
- self.do_run(src, 'caught std::exception')
+ self.do_run_from_file(src, output)
def test_async_exit(self):
open('main.c', 'w').write(r'''