aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-17 12:54:55 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-17 17:56:17 -0700
commitdb3ab955c6167dec0e3d694b13b381f6bf7fb330 (patch)
tree770462d2525f58dfaad796e485cfa43b6f3782c8 /tests
parentdc797a4570fcb776020c886581f6de7feaf734ea (diff)
fuse if-elses where the relooper did not emit a label clearing
Diffstat (limited to 'tests')
-rw-r--r--tests/test_other.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index 0c597e9f..88a5c9c5 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -2586,7 +2586,8 @@ int main()
[['-profiling', '-g2'], nums[2]]
]:
print opts, ifs
- Popen([PYTHON, EMCC, 'src.c', '-O2'] + opts, stdout=PIPE, stderr=PIPE).communicate()
+ try_delete('a.out.js')
+ Popen([PYTHON, EMCC, 'src.c', '-O2'] + opts, stdout=PIPE).communicate()
src = open('a.out.js').read()
main = src[src.find('function _main'):src.find('\n}', src.find('function _main'))]
actual_ifs = main.count('if (')
@@ -2620,3 +2621,19 @@ int main()
}
''', [8, 5, 5])
+ test(r'''
+ #include <stdio.h>
+ #include <string.h>
+ int main(int argc, char **argv) {
+ while (argc % 17 == 0) argc *= 2;
+ if (argc > 5 && strlen(argv[0]) > 10 && strlen(argv[1]) > 20) {
+ printf("halp");
+ argc++;
+ } else {
+ printf("%d\n", argc--);
+ }
+ while (argc % 17 == 0) argc *= 2;
+ return argc;
+ }
+ ''', [6, 3, 3])
+