summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Buckmaster <daniel@crabmusket.net>2019-08-08 21:25:39 +1000
committerRyan Dahl <ry@tinyclouds.org>2019-08-08 07:25:39 -0400
commit520bdb6c31dd08b6f4e52de5116fd23d6d57fdda (patch)
tree1214cfdfb2cc032ee729f26f3738f7bda7e186f4 /tools
parente438ac2c74c823882dc9c9ecde2a9e9ed7bcfb4b (diff)
Fix repl crash when deno dir doesn't exist (#2727)
Diffstat (limited to 'tools')
-rw-r--r--tools/repl_test.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/repl_test.py b/tools/repl_test.py
index 5ad7722ee..77e54dfdf 100644
--- a/tools/repl_test.py
+++ b/tools/repl_test.py
@@ -11,7 +11,12 @@ class TestRepl(DenoTestCase):
def input(self, *lines, **kwargs):
exit_ = kwargs.pop("exit", True)
sleep_ = kwargs.pop("sleep", 0)
- p = Popen([self.deno_exe], stdout=PIPE, stderr=PIPE, stdin=PIPE)
+ env_ = kwargs.pop("env", None)
+ p = Popen([self.deno_exe],
+ stdout=PIPE,
+ stderr=PIPE,
+ stdin=PIPE,
+ env=env_)
try:
# Note: The repl takes a >100ms until it's ready.
time.sleep(sleep_)
@@ -137,6 +142,14 @@ class TestRepl(DenoTestCase):
self.assertEqual(err, '')
self.assertEqual(code, 0)
+ def test_missing_deno_dir(self):
+ new_env = os.environ.copy()
+ new_env["DENO_DIR"] = os.path.abspath("doesnt_exist")
+ out, err, code = self.input("'noop'", exit=False, env=new_env)
+ self.assertEqual(out, "noop\n")
+ self.assertTrue(err.startswith("Unable to save REPL history:"))
+ self.assertEqual(code, 0)
+
if __name__ == "__main__":
run_tests()