(self)
| 3011 | cflags=['--pre-js', 'pre.js', '--pre-js', 'pre2.js']) |
| 3012 | |
| 3013 | def test_extern_prepost(self): |
| 3014 | create_file('extern-pre.js', '// I am an external pre.\n') |
| 3015 | create_file('extern-post.js', '// I am an external post.\n') |
| 3016 | self.run_process([EMCC, '-O2', test_file('hello_world.c'), '--extern-pre-js', 'extern-pre.js', '--extern-post-js', 'extern-post.js', '--closure=1']) |
| 3017 | # the files should be included, and externally - not as part of optimized |
| 3018 | # code, so they are the very first and last things, and they are not |
| 3019 | # minified. |
| 3020 | js = read_file('a.out.js') |
| 3021 | js_size = len(js) |
| 3022 | print('js_size', js_size) |
| 3023 | pre_offset = js.index('// I am an external pre.') |
| 3024 | post_offset = js.index('// I am an external post.') |
| 3025 | # ignore some slack - newlines and other things. we just care about the |
| 3026 | # big picture here |
| 3027 | SLACK = 50 |
| 3028 | self.assertLess(pre_offset, post_offset) |
| 3029 | self.assertLess(pre_offset, SLACK) |
| 3030 | self.assertGreater(post_offset, js_size - SLACK) |
| 3031 | # make sure the slack is tiny compared to the whole program |
| 3032 | self.assertGreater(js_size, 50 * SLACK) |
| 3033 | |
| 3034 | @parameterized({ |
| 3035 | 'minifyGlobals': (['minifyGlobals'],), |
nothing calls this directly
no test coverage detected