aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 11:48:35 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:54 +0200
commit2bc50ae56c8c1c39fb1362cf02dd263c1f495b35 (patch)
tree421640e1018783daad5d65b1d4d35809a1e78763 /tests
parenta79233eb34e9060d09b342522ffa1c26fe69ad7c (diff)
Use do_run_from_file() for test_dynamic_cast
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_dynamic_cast.in17
-rw-r--r--tests/core/test_dynamic_cast.out1
-rw-r--r--tests/test_core.py20
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/core/test_dynamic_cast.in b/tests/core/test_dynamic_cast.in
new file mode 100644
index 00000000..ebe9263b
--- /dev/null
+++ b/tests/core/test_dynamic_cast.in
@@ -0,0 +1,17 @@
+
+ #include <stdio.h>
+
+ struct Support {
+ virtual void f() {
+ printf("f()\n");
+ }
+ };
+
+ struct Derived : Support {
+ };
+
+ int main() {
+ Support * p = new Derived;
+ dynamic_cast<Derived*>(p)->f();
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_dynamic_cast.out b/tests/core/test_dynamic_cast.out
new file mode 100644
index 00000000..a19096b5
--- /dev/null
+++ b/tests/core/test_dynamic_cast.out
@@ -0,0 +1 @@
+f()
diff --git a/tests/test_core.py b/tests/test_core.py
index 50e4baa0..162d8525 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1498,24 +1498,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_dynamic_cast(self):
if self.emcc_args is None: return self.skip('need libcxxabi')
- src = r'''
- #include <stdio.h>
-
- struct Support {
- virtual void f() {
- printf("f()\n");
- }
- };
-
- struct Derived : Support {
- };
+ test_path = path_from_root('tests', 'core', 'test_dynamic_cast')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main() {
- Support * p = new Derived;
- dynamic_cast<Derived*>(p)->f();
- }
- '''
- self.do_run(src, 'f()\n')
+ self.do_run_from_file(src, output)
def test_dynamic_cast_b(self):
if self.emcc_args is None: return self.skip('need libcxxabi')