diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 14:16:06 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:58 +0200 |
commit | 621ed6c081c49d9b6ffc76d58d6898350f9c5411 (patch) | |
tree | 6aa7a321cc1146e0ca77e5571be003be3df21b21 | |
parent | 7a9ec7605bf389a9f9ee0c3ea90b5100c54b4135 (diff) |
Use do_run_from_file() for test_trickystring
-rw-r--r-- | tests/core/test_trickystring.in | 26 | ||||
-rw-r--r-- | tests/core/test_trickystring.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 29 |
3 files changed, 30 insertions, 26 deletions
diff --git a/tests/core/test_trickystring.in b/tests/core/test_trickystring.in new file mode 100644 index 00000000..95744369 --- /dev/null +++ b/tests/core/test_trickystring.in @@ -0,0 +1,26 @@ + + #include <stdio.h> + + typedef struct + { + int (*f)(void *); + void *d; + char s[16]; + } LMEXFunctionStruct; + + int f(void *user) + { + return 0; + } + + static LMEXFunctionStruct const a[] = + { + {f, (void *)(int)'a', "aa"} + }; + + int main() + { + printf("ok\n"); + return a[0].f(a[0].d); + } +
\ No newline at end of file diff --git a/tests/core/test_trickystring.out b/tests/core/test_trickystring.out new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/tests/core/test_trickystring.out @@ -0,0 +1 @@ +ok diff --git a/tests/test_core.py b/tests/test_core.py index da74e5a0..a69764eb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2496,33 +2496,10 @@ The current type of b is: 9 self.do_run(src, 'fault on write to 0' if not Settings.ASM_JS else 'abort()') def test_trickystring(self): - src = r''' - #include <stdio.h> - - typedef struct - { - int (*f)(void *); - void *d; - char s[16]; - } LMEXFunctionStruct; - - int f(void *user) - { - return 0; - } - - static LMEXFunctionStruct const a[] = - { - {f, (void *)(int)'a', "aa"} - }; + test_path = path_from_root('tests', 'core', 'test_trickystring') + src, output = (test_path + s for s in ('.in', '.out')) - int main() - { - printf("ok\n"); - return a[0].f(a[0].d); - } - ''' - self.do_run(src, 'ok\n') + self.do_run_from_file(src, output) def test_statics(self): # static initializers save i16 but load i8 for some reason (or i64 and load i8) |