1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 12:58:54 -05:00

Fix unit_tests.py (#2065)

They were silently broken in 780e72 due to flag reordering. This commit
also includes a new assert that would avoid that kind of failure in the
future.
This commit is contained in:
Ryan Dahl 2019-04-07 20:58:26 +03:00 committed by GitHub
parent 3324afbd40
commit 3995473925
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,8 @@ def run_unit_test2(cmd):
errcode = process.returncode errcode = process.returncode
if errcode != 0: if errcode != 0:
sys.exit(errcode) sys.exit(errcode)
# To avoid the case where we silently filter out all tests.
assert expected > 0
if actual == None and expected == None: if actual == None and expected == None:
raise AssertionError("Bad js/unit_test.ts output") raise AssertionError("Bad js/unit_test.ts output")
if expected != actual: if expected != actual:
@ -32,7 +34,7 @@ def run_unit_test2(cmd):
def run_unit_test(deno_exe, permStr, flags=None): def run_unit_test(deno_exe, permStr, flags=None):
if flags is None: if flags is None:
flags = [] flags = []
cmd = [deno_exe, "js/unit_tests.ts"] + flags + [permStr] cmd = [deno_exe] + flags + ["js/unit_tests.ts", permStr]
run_unit_test2(cmd) run_unit_test2(cmd)
@ -48,7 +50,6 @@ def unit_tests(deno_exe):
run_unit_test(deno_exe, "permR0W1N0E0U0", ["--allow-write"]) run_unit_test(deno_exe, "permR0W1N0E0U0", ["--allow-write"])
run_unit_test(deno_exe, "permR1W1N0E0U0", run_unit_test(deno_exe, "permR1W1N0E0U0",
["--allow-read", "--allow-write"]) ["--allow-read", "--allow-write"])
run_unit_test(deno_exe, "permR1W0N1E0U0", ["--allow-read", "--allow-net"])
run_unit_test(deno_exe, "permR0W0N0E1U0", ["--allow-env"]) run_unit_test(deno_exe, "permR0W0N0E1U0", ["--allow-env"])
run_unit_test(deno_exe, "permR0W0N0E0U1", ["--allow-run"]) run_unit_test(deno_exe, "permR0W0N0E0U1", ["--allow-run"])
run_unit_test(deno_exe, "permR0W1N0E0U1", ["--allow-run", "--allow-write"]) run_unit_test(deno_exe, "permR0W1N0E0U1", ["--allow-run", "--allow-write"])