diff options
-rw-r--r-- | src/parser.js | 2 | ||||
-rw-r--r-- | tests/runner.py | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/parser.js b/src/parser.js index 0e7fe6cf..2ba20e45 100644 --- a/src/parser.js +++ b/src/parser.js @@ -1912,7 +1912,7 @@ function JSify(data) { if (isNumberType(type) || pointingLevels(type) == 1) { return makePointer(parseNumerical(value.text)); } else if (value.text == 'zeroinitializer') { - return JSON.stringify(makeEmptyStruct(type)); + return makePointer(JSON.stringify(makeEmptyStruct(type))); } else if (value.text[0] == '"') { value.text = value.text.substr(1, value.text.length-2); return makePointer('intArrayFromString("' + value.text + '")'); diff --git a/tests/runner.py b/tests/runner.py index 7bbfa80f..4d2c51c3 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -642,6 +642,27 @@ class T(unittest.TestCase): ''' self.do_test(src, '*cleaned*') + def test_statics(self): + src = ''' + #include <stdio.h> + #include <string.h> + + #define CONSTRLEN 32 + + void conoutfv(const char *fmt) + { + static char buf[CONSTRLEN]; + strcpy(buf, fmt); + puts(buf); + } + + int main() { + conoutfv("*staticccz*"); + return 0; + } + ''' + self.do_test(src, '*staticccz*') + def test_fannkuch(self): results = [ (1,0), (2,1), (3,2), (4,4), (5,7), (6,10), (7, 16), (8,22) ] for i, j in results: |