summaryrefslogtreecommitdiff
path: root/tools/check_output_test.py
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-08-19 03:00:34 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-08-21 18:34:56 -0400
commit790baae673fd60c36f47b9f9b31c9cf132ba3437 (patch)
tree8ffd1f1932e8fe0144e5920551449ac1417c68e9 /tools/check_output_test.py
parent18d495c7d17cf3fce3835e732094d058f51eddaa (diff)
Expose deno.exit() and add test.
Diffstat (limited to 'tools/check_output_test.py')
-rwxr-xr-xtools/check_output_test.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/check_output_test.py b/tools/check_output_test.py
index cba3b0c56..54aff4e0c 100755
--- a/tools/check_output_test.py
+++ b/tools/check_output_test.py
@@ -7,7 +7,7 @@
import os
import sys
import subprocess
-from util import pattern_match
+from util import pattern_match, parse_exit_code
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
tests_path = os.path.join(root_path, "tests")
@@ -27,21 +27,23 @@ def check_output_test(deno_exe_filename):
with open(out_abs, 'r') as f:
expected_out = f.read()
cmd = [deno_exe_filename, script_abs]
- should_succeed = "error" not in script
+ expected_code = parse_exit_code(script)
print " ".join(cmd)
- err = False
+ actual_code = 0
try:
actual_out = subprocess.check_output(cmd, universal_newlines=True)
except subprocess.CalledProcessError as e:
- err = True
+ actual_code = e.returncode
actual_out = e.output
- if should_succeed == True:
+ if expected_code == 0:
print "Expected success but got error. Output:"
print actual_out
sys.exit(1)
- if should_succeed == False and err == False:
- print "Expected an error but succeeded. Output:"
+ if expected_code != actual_code:
+ print "Expected exit code %d but got %d" % (expected_code,
+ actual_code)
+ print "Output:"
print actual_out
sys.exit(1)