aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_trickystring.in26
-rw-r--r--tests/core/test_trickystring.out1
-rw-r--r--tests/test_core.py29
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)