summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 3853e6fe4..7e0e020d6 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -1507,6 +1507,39 @@ itest!(deno_test_only {
});
#[test]
+fn timeout_clear() {
+ // https://github.com/denoland/deno/issues/7599
+
+ use std::time::Duration;
+ use std::time::Instant;
+
+ let source_code = r#"
+const handle = setTimeout(() => {
+ console.log("timeout finish");
+}, 10000);
+clearTimeout(handle);
+console.log("finish");
+"#;
+
+ let mut p = util::deno_cmd()
+ .current_dir(util::tests_path())
+ .arg("run")
+ .arg("-")
+ .stdin(std::process::Stdio::piped())
+ .spawn()
+ .unwrap();
+ let stdin = p.stdin.as_mut().unwrap();
+ stdin.write_all(source_code.as_bytes()).unwrap();
+ let start = Instant::now();
+ let status = p.wait().unwrap();
+ let end = Instant::now();
+ assert!(status.success());
+ // check that program did not run for 10 seconds
+ // for timeout to clear
+ assert!(end - start < Duration::new(10, 0));
+}
+
+#[test]
fn workers() {
let _g = util::http_server();
let status = util::deno_cmd()