summaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 11:30:46 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:53 +0200
commit3edbf126a5b79642a0463a6105b3bd584383017d (patch)
tree70b0518c258abfef9de0b0023bec182c5e3d0850 /tests/test_core.py
parentee0451103e6535582084c4665eff907c515d7362 (diff)
Use do_run_from_file() for test_exception_2
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py28
1 files changed, 3 insertions, 25 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 17c1dffe..b1d8f0c8 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1244,33 +1244,11 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_exception_2(self):
if self.emcc_args is None: return self.skip('need emcc to add in libcxx properly')
Settings.DISABLE_EXCEPTION_CATCHING = 0
- src = r'''
- #include <stdexcept>
- #include <stdio.h>
-
- typedef void (*FuncPtr)();
- void ThrowException()
- {
- throw std::runtime_error("catch me!");
- }
-
- FuncPtr ptr = ThrowException;
+ test_path = path_from_root('tests', 'core', 'test_exception_2')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main()
- {
- try
- {
- ptr();
- }
- catch(...)
- {
- printf("Exception caught successfully!\n");
- }
- return 0;
- }
- '''
- self.do_run(src, 'Exception caught successfully!')
+ self.do_run_from_file(src, output)
def test_white_list_exception(self):
Settings.DISABLE_EXCEPTION_CATCHING = 2