diff options
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index f9f46f10..de3c72de 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -3336,6 +3336,36 @@ Exiting setjmp function, level: 0, prev_jmp: -1 ''' self.do_run(src, '*0x1*') + def test_funcptr_namecollide(self): + src = r''' + #include <stdio.h> + + void do_call(void (*puts)(const char *), const char *str); + + void do_print(const char *str) { + if (!str) do_call(NULL, "delusion"); + if ((int)str == -1) do_print(str+10); + puts("===="); + puts(str); + puts("===="); + } + + void do_call(void (*puts)(const char *), const char *str) { + if (!str) do_print("confusion"); + if ((int)str == -1) do_call(NULL, str-10); + (*puts)(str); + } + + int main(int argc, char **argv) + { + for (int i = 0; i < argc; i++) { + do_call(i != 10 ? do_print : NULL, i != 15 ? "waka waka" : NULL); + } + return 0; + } + ''' + self.do_run(src, 'waka', force_c=True) + def test_emptyclass(self): if self.emcc_args is None: return self.skip('requires emcc') src = ''' |