summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/is_tty_test.py24
-rwxr-xr-xtools/test.py4
2 files changed, 27 insertions, 1 deletions
diff --git a/tools/is_tty_test.py b/tools/is_tty_test.py
new file mode 100755
index 000000000..218e7f620
--- /dev/null
+++ b/tools/is_tty_test.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+import os
+import pty
+import select
+import subprocess
+from util import build_path, executable_suffix
+from sys import stdin
+from permission_prompt_test import tty_capture
+
+IS_TTY_TEST_TS = "tests/is_tty.ts"
+
+def is_tty_test(deno_exe):
+ cmd = [deno_exe, IS_TTY_TEST_TS]
+ code, stdout, _ = tty_capture(cmd, b'')
+ assert code == 0
+ assert str(stdin.isatty()).lower() in stdout
+
+def main():
+ deno_exe = os.path.join(build_path(), "deno" + executable_suffix)
+ is_tty_test(deno_exe)
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/test.py b/tools/test.py
index 8da13b01a..246b094b7 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -66,12 +66,14 @@ def main(argv):
integration_tests(deno_exe)
- # TODO We currently skip testing the prompt in Windows completely.
+ # TODO We currently skip testing the prompt and IsTTY in Windows completely.
# Windows does not support the pty module used for testing the permission
# prompt.
if os.name != 'nt':
from permission_prompt_test import permission_prompt_test
+ from is_tty_test import is_tty_test
permission_prompt_test(deno_exe)
+ is_tty_test(deno_exe)
repl_tests(deno_exe)