aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-28 14:59:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-28 14:59:04 -0700
commit0b222be053ad17a677938c3156c47842b7389a6d (patch)
treecbab9605bf8116c26b2b39baf9506a5bc429a894
parent0be34770addebcc0e7b21bf4fca7694cc5e00592 (diff)
fix string detection regexp and add test
-rw-r--r--src/intertyper.js2
-rwxr-xr-xtests/runner.py29
2 files changed, 30 insertions, 1 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index d9db10f9..6b91f527 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -74,7 +74,7 @@ function intertyper(data, sidePass, baseLineNums) {
var global = /([@%\w\d\.\" $-]+) = .*/.exec(line);
var globalIdent = toNiceIdent(global[1]);
var testAlias = /[@%\w\d\.\" $-]+ = alias .*/.exec(line);
- var testString = /^[^"]+c\"[^"]+"/.exec(line);
+ var testString = /[@%\w\d\.\" $-]+ = [\w ]+ \[\d+ x i8] c".*/.exec(line);
Variables.globals[globalIdent] = {
name: globalIdent,
alias: !!testAlias,
diff --git a/tests/runner.py b/tests/runner.py
index 1856016f..8e2e7b28 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2866,6 +2866,35 @@ def process(filename):
'''
self.do_run(src, 'fault on write to 0')
+ 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"}
+ };
+
+ int main()
+ {
+ printf("ok\n");
+ return a[0].f(a[0].d);
+ }
+ '''
+ self.do_run(src, 'ok\n')
+
def test_statics(self):
# static initializers save i16 but load i8 for some reason
if Settings.SAFE_HEAP: