2020-01-21 10:01:55 -05:00
|
|
|
# Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-05-30 16:40:40 -04:00
|
|
|
import os
|
2019-05-27 09:27:55 -04:00
|
|
|
|
2019-06-03 12:35:55 -04:00
|
|
|
from test_util import DenoTestCase, run_tests
|
2020-08-28 09:03:50 -04:00
|
|
|
from util import (parse_exit_code, shell_quote_win, root_path)
|
2018-08-10 13:38:32 -04:00
|
|
|
|
|
|
|
|
2019-05-30 16:40:40 -04:00
|
|
|
class TestUtil(DenoTestCase):
|
2019-05-27 09:27:55 -04:00
|
|
|
def test_parse_exit_code(self):
|
2019-09-11 16:47:42 -04:00
|
|
|
assert parse_exit_code('hello_error54_world') == 54
|
|
|
|
assert parse_exit_code('hello_error_world') == 1
|
|
|
|
assert parse_exit_code('hello_world') == 0
|
2019-05-27 09:27:55 -04:00
|
|
|
|
|
|
|
def test_shell_quote_win(self):
|
2019-09-11 16:47:42 -04:00
|
|
|
assert shell_quote_win('simple') == 'simple'
|
|
|
|
assert shell_quote_win(
|
|
|
|
'roof/\\isoprojection') == 'roof/\\isoprojection'
|
|
|
|
assert shell_quote_win('with space') == '"with space"'
|
|
|
|
assert shell_quote_win('embedded"quote') == '"embedded""quote"'
|
|
|
|
assert shell_quote_win(
|
|
|
|
'a"b""c\\d\\"e\\\\') == '"a""b""""c\\d\\\\""e\\\\\\\\"'
|
2019-05-27 09:27:55 -04:00
|
|
|
|
2020-05-06 16:34:48 -04:00
|
|
|
def test_executable_exists(self):
|
|
|
|
assert os.path.exists(self.deno_exe)
|
|
|
|
|
2018-10-15 16:44:35 -04:00
|
|
|
|
2018-08-19 03:00:34 -04:00
|
|
|
if __name__ == '__main__':
|
2019-06-03 12:35:55 -04:00
|
|
|
run_tests()
|