diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-03-22 15:10:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 15:10:00 -0400 |
commit | 6268a1a6fde0980ea5eb86c689a89d2c41aab6d4 (patch) | |
tree | 2c6267ac87b0cccf3c60197f648f177eeef7f8bb /cli/tests/integration/fmt_tests.rs | |
parent | e46b5f738dcb701401d8b6912cce5b937b682fe0 (diff) |
chore: replace `.expect("...")` calls with `.unwrap()` in test code (#14081)
Diffstat (limited to 'cli/tests/integration/fmt_tests.rs')
-rw-r--r-- | cli/tests/integration/fmt_tests.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs index bb4c8b451..aa807b727 100644 --- a/cli/tests/integration/fmt_tests.rs +++ b/cli/tests/integration/fmt_tests.rs @@ -6,30 +6,27 @@ use test_util as util; #[test] fn fmt_test() { - let t = TempDir::new().expect("tempdir fail"); + let t = TempDir::new().unwrap(); let fixed_js = util::testdata_path().join("badly_formatted_fixed.js"); let badly_formatted_original_js = util::testdata_path().join("badly_formatted.mjs"); let badly_formatted_js = t.path().join("badly_formatted.js"); let badly_formatted_js_str = badly_formatted_js.to_str().unwrap(); - std::fs::copy(&badly_formatted_original_js, &badly_formatted_js) - .expect("Failed to copy file"); + std::fs::copy(&badly_formatted_original_js, &badly_formatted_js).unwrap(); let fixed_md = util::testdata_path().join("badly_formatted_fixed.md"); let badly_formatted_original_md = util::testdata_path().join("badly_formatted.md"); let badly_formatted_md = t.path().join("badly_formatted.md"); let badly_formatted_md_str = badly_formatted_md.to_str().unwrap(); - std::fs::copy(&badly_formatted_original_md, &badly_formatted_md) - .expect("Failed to copy file"); + std::fs::copy(&badly_formatted_original_md, &badly_formatted_md).unwrap(); let fixed_json = util::testdata_path().join("badly_formatted_fixed.json"); let badly_formatted_original_json = util::testdata_path().join("badly_formatted.json"); let badly_formatted_json = t.path().join("badly_formatted.json"); let badly_formatted_json_str = badly_formatted_json.to_str().unwrap(); - std::fs::copy(&badly_formatted_original_json, &badly_formatted_json) - .expect("Failed to copy file"); + std::fs::copy(&badly_formatted_original_json, &badly_formatted_json).unwrap(); // First, check formatting by ignoring the badly formatted file. let status = util::deno_cmd() .current_dir(util::testdata_path()) @@ -43,9 +40,9 @@ fn fmt_test() { .arg(badly_formatted_md_str) .arg(badly_formatted_json_str) .spawn() - .expect("Failed to spawn script") + .unwrap() .wait() - .expect("Failed to wait for child process"); + .unwrap(); // No target files found assert!(!status.success()); @@ -58,9 +55,9 @@ fn fmt_test() { .arg(badly_formatted_md_str) .arg(badly_formatted_json_str) .spawn() - .expect("Failed to spawn script") + .unwrap() .wait() - .expect("Failed to wait for child process"); + .unwrap(); assert!(!status.success()); // Format the source file. @@ -71,9 +68,9 @@ fn fmt_test() { .arg(badly_formatted_md_str) .arg(badly_formatted_json_str) .spawn() - .expect("Failed to spawn script") + .unwrap() .wait() - .expect("Failed to wait for child process"); + .unwrap(); assert!(status.success()); let expected_js = std::fs::read_to_string(fixed_js).unwrap(); let expected_md = std::fs::read_to_string(fixed_md).unwrap(); |