mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 04:48:52 -05:00
remove target_test.py (#5112)
This commit is contained in:
parent
221221cc97
commit
6666f1d36a
3 changed files with 33 additions and 41 deletions
|
@ -12,6 +12,36 @@ use std::io::BufRead;
|
|||
use std::process::Command;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
fn no_color() {
|
||||
let output = util::deno_cmd()
|
||||
.current_dir(util::root_path())
|
||||
.arg("run")
|
||||
.arg("cli/tests/no_color.js")
|
||||
.env("NO_COLOR", "1")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap()
|
||||
.wait_with_output()
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim();
|
||||
assert_eq!("noColor true", stdout_str);
|
||||
|
||||
let output = util::deno_cmd()
|
||||
.current_dir(util::root_path())
|
||||
.arg("run")
|
||||
.arg("cli/tests/no_color.js")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap()
|
||||
.wait_with_output()
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim();
|
||||
assert_eq!("noColor false", stdout_str);
|
||||
}
|
||||
|
||||
// TODO re-enable. This hangs on macOS
|
||||
// https://github.com/denoland/deno/issues/4262
|
||||
#[cfg(unix)]
|
||||
|
@ -780,11 +810,6 @@ fn repl_test_assign_underscore_error() {
|
|||
assert_eq!(err, "Thrown: 2\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn target_test() {
|
||||
util::run_python_script("tools/target_test.py")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn util_test() {
|
||||
util::run_python_script("tools/util_test.py")
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from test_util import DenoTestCase, run_tests
|
||||
from util import executable_suffix, tests_path, run, run_output
|
||||
|
||||
|
||||
class TestTarget(DenoTestCase):
|
||||
@staticmethod
|
||||
def check_exists(filename):
|
||||
if not os.path.exists(filename):
|
||||
print "Required target doesn't exist:", filename
|
||||
sys.exit(1)
|
||||
|
||||
def test_executable_exists(self):
|
||||
self.check_exists(self.deno_exe)
|
||||
|
||||
def _test(self, executable):
|
||||
"Test executable runs and exits with code 0."
|
||||
bin_file = os.path.join(self.build_dir, executable + executable_suffix)
|
||||
self.check_exists(bin_file)
|
||||
run([bin_file], quiet=True)
|
||||
|
||||
def test_no_color(self):
|
||||
t = os.path.join(tests_path, "no_color.js")
|
||||
result = run_output([self.deno_exe, "run", t],
|
||||
merge_env={"NO_COLOR": "1"},
|
||||
quiet=True)
|
||||
assert result.out.strip() == "noColor true"
|
||||
t = os.path.join(tests_path, "no_color.js")
|
||||
result = run_output([self.deno_exe, "run", t], quiet=True)
|
||||
assert result.out.strip() == "noColor false"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
|
@ -37,6 +37,9 @@ class TestUtil(DenoTestCase):
|
|||
assert stats3['req_per_sec'] == 96037
|
||||
assert stats3['max_latency'] == 6.36
|
||||
|
||||
def test_executable_exists(self):
|
||||
assert os.path.exists(self.deno_exe)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_tests()
|
||||
|
|
Loading…
Reference in a new issue