this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at f26a525327ea65cc8a0ba85bb6825e4691c3f435 27 lines 880 B view raw
1// Each `tests/*.rs` file compiles as its own crate, so any helper not used by 2// a particular file shows up as dead code in that crate. Allow it globally. 3#![allow(dead_code)] 4 5use assert_fs::prelude::*; 6use predicates::prelude::*; 7 8pub fn create_test_file( 9 name: &str, 10 content: &str, 11) -> Result<assert_fs::NamedTempFile, Box<dyn std::error::Error>> { 12 let file = assert_fs::NamedTempFile::new(name)?; 13 file.write_str(content)?; 14 Ok(file) 15} 16 17pub fn create_working_dir() -> Result<assert_fs::TempDir, Box<dyn std::error::Error>> { 18 Ok(assert_fs::TempDir::new()?) 19} 20 21pub fn create_persistent_working_dir() -> Result<assert_fs::TempDir, Box<dyn std::error::Error>> { 22 Ok(assert_fs::TempDir::new()?.into_persistent()) 23} 24 25pub fn assert_files_equal(file1: &std::path::Path, file2: &std::path::Path) { 26 assert!(predicate::path::eq_file(file1).eval(file2)); 27}