summaryrefslogtreecommitdiff
path: root/test/unit/test_asyncify.py
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-08-16 13:31:52 -0700
committerGuanzhong Chen <gzchen@google.com>2019-08-16 13:31:52 -0700
commitc8a797d120a1413d993281c98268c1c2ee9f3f94 (patch)
tree30b0d00b8af103e1b8a751f292f0241a02af9a79 /test/unit/test_asyncify.py
parentee0564088c7f89814bf951cc5936aa096538e38f (diff)
downloadbinaryen-c8a797d120a1413d993281c98268c1c2ee9f3f94.tar.gz
binaryen-c8a797d120a1413d993281c98268c1c2ee9f3f94.tar.bz2
binaryen-c8a797d120a1413d993281c98268c1c2ee9f3f94.zip
Switch python indentation from 2-space to 4-space (#2299)
pep8 specifies 4 space indentation. The use of 2 spaces is, I believe a historical anomaly where certain large organizations such as google chose 2 over 4 and have yet to make the switch. Since there isn't too much code in binaryen today it seems reasonable to make the switch.
Diffstat (limited to 'test/unit/test_asyncify.py')
-rw-r--r--test/unit/test_asyncify.py80
1 files changed, 40 insertions, 40 deletions
diff --git a/test/unit/test_asyncify.py b/test/unit/test_asyncify.py
index f2d7839b6..a8161cc1d 100644
--- a/test/unit/test_asyncify.py
+++ b/test/unit/test_asyncify.py
@@ -6,47 +6,47 @@ from .utils import BinaryenTestCase
class AsyncifyTest(BinaryenTestCase):
- def test_asyncify_js(self):
- def test(args):
- print(args)
- run_process(WASM_OPT + args + [self.input_path('asyncify-sleep.wast'), '--asyncify', '-o', 'a.wasm'])
- run_process(WASM_OPT + args + [self.input_path('asyncify-coroutine.wast'), '--asyncify', '-o', 'b.wasm'])
- run_process(WASM_OPT + args + [self.input_path('asyncify-stackOverflow.wast'), '--asyncify', '-o', 'c.wasm'])
- print(' file size: %d' % os.path.getsize('a.wasm'))
- run_process([NODEJS, self.input_path('asyncify.js')])
+ def test_asyncify_js(self):
+ def test(args):
+ print(args)
+ run_process(WASM_OPT + args + [self.input_path('asyncify-sleep.wast'), '--asyncify', '-o', 'a.wasm'])
+ run_process(WASM_OPT + args + [self.input_path('asyncify-coroutine.wast'), '--asyncify', '-o', 'b.wasm'])
+ run_process(WASM_OPT + args + [self.input_path('asyncify-stackOverflow.wast'), '--asyncify', '-o', 'c.wasm'])
+ print(' file size: %d' % os.path.getsize('a.wasm'))
+ run_process([NODEJS, self.input_path('asyncify.js')])
- test(['-g'])
- test([])
- test(['-O1'])
- test(['--optimize-level=1'])
- test(['-O3'])
- test(['-Os', '-g'])
+ test(['-g'])
+ test([])
+ test(['-O1'])
+ test(['--optimize-level=1'])
+ test(['-O3'])
+ test(['-Os', '-g'])
- def test_asyncify_pure_wasm(self):
- run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '-o', 'a.wasm'])
- run_process(WASM_DIS + ['a.wasm', '-o', 'a.wast'])
- output = run_process(WASM_SHELL + ['a.wast'], capture_output=True).stdout
- with open(self.input_path('asyncify-pure.txt'), 'r') as f:
- self.assertEqual(f.read(), output)
+ def test_asyncify_pure_wasm(self):
+ run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '-o', 'a.wasm'])
+ run_process(WASM_DIS + ['a.wasm', '-o', 'a.wast'])
+ output = run_process(WASM_SHELL + ['a.wast'], capture_output=True).stdout
+ with open(self.input_path('asyncify-pure.txt'), 'r') as f:
+ self.assertEqual(f.read(), output)
- def test_asyncify_list_bad(self):
- for arg, warning in [
- ('--pass-arg=asyncify-blacklist@nonexistent', 'nonexistent'),
- ('--pass-arg=asyncify-whitelist@nonexistent', 'nonexistent'),
- ('--pass-arg=asyncify-blacklist@main', None),
- ('--pass-arg=asyncify-whitelist@main', None),
- ('--pass-arg=asyncify-whitelist@main', None),
- ('--pass-arg=asyncify-whitelist@DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)', None),
- ]:
- print(arg, warning)
- err = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr.strip()
- if warning:
- self.assertIn('warning', err)
- self.assertIn(warning, err)
- else:
- self.assertNotIn('warning', err)
+ def test_asyncify_list_bad(self):
+ for arg, warning in [
+ ('--pass-arg=asyncify-blacklist@nonexistent', 'nonexistent'),
+ ('--pass-arg=asyncify-whitelist@nonexistent', 'nonexistent'),
+ ('--pass-arg=asyncify-blacklist@main', None),
+ ('--pass-arg=asyncify-whitelist@main', None),
+ ('--pass-arg=asyncify-whitelist@main', None),
+ ('--pass-arg=asyncify-whitelist@DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)', None),
+ ]:
+ print(arg, warning)
+ err = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr.strip()
+ if warning:
+ self.assertIn('warning', err)
+ self.assertIn(warning, err)
+ else:
+ self.assertNotIn('warning', err)
- def test_asyncify_blacklist_and_whitelist(self):
- proc = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '--pass-arg=asyncify-whitelist@main', '--pass-arg=asyncify-blacklist@main'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
- self.assertNotEqual(proc.returncode, 0, 'must error on using both lists at once')
- self.assertIn('It makes no sense to use both a blacklist and a whitelist with asyncify', proc.stdout)
+ def test_asyncify_blacklist_and_whitelist(self):
+ proc = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '--pass-arg=asyncify-whitelist@main', '--pass-arg=asyncify-blacklist@main'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
+ self.assertNotEqual(proc.returncode, 0, 'must error on using both lists at once')
+ self.assertIn('It makes no sense to use both a blacklist and a whitelist with asyncify', proc.stdout)