Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2868,16 +2868,18 @@ def test_extern_prepost(self):
# code, so they are the very first and last things, and they are not
# minified.
js = read_file('a.out.js')
pre = js.index('// I am an external pre.')
post = js.index('// I am an external post.')
js_size = len(js)
print('js_size', js_size)
pre_offset = js.index('// I am an external pre.')
post_offset = js.index('// I am an external post.')
# ignore some slack - newlines and other things. we just care about the
# big picture here
SLACK = 50
self.assertLess(pre, post)
self.assertLess(pre, SLACK)
self.assertGreater(post, len(js) - SLACK)
self.assertLess(pre_offset, post_offset)
self.assertLess(pre_offset, SLACK)
self.assertGreater(post_offset, js_size - SLACK)
# make sure the slack is tiny compared to the whole program
self.assertGreater(len(js), 100 * SLACK)
self.assertGreater(js_size, 50 * SLACK)

@parameterized({
'minifyGlobals': (['minifyGlobals'],),
Expand Down
Loading