convert programs into tests
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
use std::{fs::OpenOptions, io::Write, os::unix::fs::OpenOptionsExt};
|
||||
|
||||
pub fn write(path: &str, binary: &[u8]) {
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
.truncate(true)
|
||||
.mode(0o750)
|
||||
.open(path)
|
||||
.expect("Failed to create file");
|
||||
file.write_all(binary).expect("Failed to write to file");
|
||||
file.sync_all().expect("Failed to sync file");
|
||||
}
|
||||
Reference in New Issue
Block a user