// Each `tests/*.rs` file compiles as its own crate, so any helper not used by // a particular file shows up as dead code in that crate. Allow it globally. #![allow(dead_code)] use assert_fs::prelude::*; use predicates::prelude::*; pub fn create_test_file( name: &str, content: &str, ) -> Result> { let file = assert_fs::NamedTempFile::new(name)?; file.write_str(content)?; Ok(file) } pub fn create_working_dir() -> Result> { Ok(assert_fs::TempDir::new()?) } pub fn create_persistent_working_dir() -> Result> { Ok(assert_fs::TempDir::new()?.into_persistent()) } pub fn assert_files_equal(file1: &std::path::Path, file2: &std::path::Path) { assert!(predicate::path::eq_file(file1).eval(file2)); }