diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/bench_tests.rs | 10 | ||||
-rw-r--r-- | cli/tests/integration/cert_tests.rs | 28 | ||||
-rw-r--r-- | cli/tests/integration/mod.rs | 12 | ||||
-rw-r--r-- | cli/tests/integration/test_tests.rs | 8 |
4 files changed, 27 insertions, 31 deletions
diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 4e94463e5..6da30857f 100644 --- a/cli/tests/integration/bench_tests.rs +++ b/cli/tests/integration/bench_tests.rs @@ -3,8 +3,6 @@ use deno_core::url::Url; use test_util as util; use util::assert_contains; -use util::assert_exit_code; -use util::assert_output_file; use util::env_vars_for_npm_tests; use util::TestContext; @@ -196,7 +194,7 @@ fn recursive_permissions_pledge() { .new_command() .args("bench bench/recursive_permissions_pledge.js") .run(); - assert_exit_code!(output, 1); + output.assert_exit_code(1); assert_contains!( output.text(), "pledge test permissions called before restoring previous pledge" @@ -210,11 +208,11 @@ fn file_protocol() { .unwrap() .to_string(); let context = TestContext::default(); - let output = context + context .new_command() .args(format!("bench bench/file_protocol.ts {file_url}")) - .run(); - assert_output_file!(output, "bench/file_protocol.out"); + .run() + .assert_matches_file("bench/file_protocol.out"); } itest!(package_json_basic { diff --git a/cli/tests/integration/cert_tests.rs b/cli/tests/integration/cert_tests.rs index 8fa439d78..003136758 100644 --- a/cli/tests/integration/cert_tests.rs +++ b/cli/tests/integration/cert_tests.rs @@ -12,8 +12,6 @@ use std::sync::Arc; use test_util as util; use test_util::TempDir; use tokio::task::LocalSet; -use util::assert_exit_code; -use util::assert_output_text; use util::TestContext; itest_flaky!(cafile_url_imports { @@ -81,14 +79,14 @@ fn cafile_env_fetch() { Url::parse("https://localhost:5545/cert/cafile_url_imports.ts").unwrap(); let context = TestContext::with_http_server(); let cafile = context.testdata_path().join("tls/RootCA.pem"); - let output = context + + context .new_command() .args(format!("cache {module_url}")) .env("DENO_CERT", cafile.to_string_lossy()) - .run(); - - assert_exit_code!(output, 0); - output.skip_output_check(); + .run() + .assert_exit_code(0) + .skip_output_check(); } #[flaky_test::flaky_test] @@ -97,17 +95,16 @@ fn cafile_fetch() { Url::parse("http://localhost:4545/cert/cafile_url_imports.ts").unwrap(); let context = TestContext::with_http_server(); let cafile = context.testdata_path().join("tls/RootCA.pem"); - let output = context + context .new_command() .args(format!( "cache --quiet --cert {} {}", cafile.to_string_lossy(), module_url, )) - .run(); - - assert_exit_code!(output, 0); - assert_output_text!(output, ""); + .run() + .assert_exit_code(0) + .assert_matches_text(""); } #[test] @@ -124,12 +121,11 @@ fn cafile_compile() { .run(); output.skip_output_check(); - let exe_output = context + context .new_command() .command_name(output_exe.to_string_lossy()) - .run(); - - assert_output_text!(exe_output, "[WILDCARD]\nHello\n"); + .run() + .assert_matches_text("[WILDCARD]\nHello\n"); } #[flaky_test::flaky_test] diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 6d1daf7d7..9c865f2ad 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -12,12 +12,12 @@ macro_rules! itest( .. Default::default() }; let output = test.output(); - test_util::assert_exit_code!(output, test.exit_code); + output.assert_exit_code(test.exit_code); if !test.output.is_empty() { assert!(test.output_str.is_none()); - test_util::assert_output_file!(output, test.output); + output.assert_matches_file(test.output); } else { - test_util::assert_output_text!(output, test.output_str.unwrap_or("")); + output.assert_matches_text(test.output_str.unwrap_or("")); } } } @@ -35,12 +35,12 @@ macro_rules! itest_flaky( .. Default::default() }; let output = test.output(); - test_util::assert_exit_code!(output, test.exit_code); + output.assert_exit_code(test.exit_code); if !test.output.is_empty() { assert!(test.output_str.is_none()); - test_util::assert_output_file!(output, test.output); + output.assert_matches_file(test.output); } else { - test_util::assert_output_text!(output, test.output_str.unwrap_or("")); + output.assert_matches_text(test.output_str.unwrap_or("")); } } } diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 0ff09e69d..b9166c510 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -2,7 +2,6 @@ use deno_core::url::Url; use test_util as util; -use util::assert_output_file; use util::env_vars_for_npm_tests; use util::TestContext; @@ -417,8 +416,11 @@ fn file_protocol() { .to_string(); let context = TestContext::default(); - let output = context.new_command().args(format!("test {file_url}")).run(); - assert_output_file!(output, "test/file_protocol.out"); + context + .new_command() + .args(format!("test {file_url}")) + .run() + .assert_matches_file("test/file_protocol.out"); } itest!(uncaught_errors { |