summaryrefslogtreecommitdiffstats
path: root/tests/workdir.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/workdir.rs')
-rw-r--r--tests/workdir.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/workdir.rs b/tests/workdir.rs
index 6a79daf7..5ef3b72e 100644
--- a/tests/workdir.rs
+++ b/tests/workdir.rs
@@ -43,9 +43,14 @@ impl WorkDir {
/// Create a new file with the given name and contents in this directory.
pub fn create<P: AsRef<Path>>(&self, name: P, contents: &str) {
+ self.create_bytes(name, contents.as_bytes());
+ }
+
+ /// Create a new file with the given name and contents in this directory.
+ pub fn create_bytes<P: AsRef<Path>>(&self, name: P, contents: &[u8]) {
let path = self.dir.join(name);
let mut file = nice_err(&path, File::create(&path));
- nice_err(&path, file.write_all(contents.as_bytes()));
+ nice_err(&path, file.write_all(contents));
nice_err(&path, file.flush());
}