add ability to save raw bytes in tests
This commit is contained in:
parent
f83baa0515
commit
ee13dd22be
1 changed files with 6 additions and 2 deletions
|
@ -16,9 +16,13 @@ impl TempSource {
|
||||||
Ok(Self { directory: tempdir()? })
|
Ok(Self { directory: tempdir()? })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_text_to_file(&self, filename: &str, text: &str) -> Result<(), Error> {
|
pub fn write_bytes_to_file(&self, filename: &str, bytes: &[u8]) -> Result<(), Error> {
|
||||||
let path = self.file_path(filename);
|
let path = self.file_path(filename);
|
||||||
Ok(File::create(path)?.write_all(text.as_bytes())?)
|
Ok(File::create(path)?.write_all(bytes)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn write_text_to_file(&self, filename: &str, text: &str) -> Result<(), Error> {
|
||||||
|
self.write_bytes_to_file(filename, text.as_bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn path(&self) -> &Path {
|
pub fn path(&self) -> &Path {
|
||||||
|
|
Loading…
Reference in a new issue