fake-editor: add dump command to be used with insta::assert_snapshot!()

This allows us to use insta against dumped content.
This commit is contained in:
Yuya Nishihara 2022-12-22 16:44:04 +09:00
parent 8613ec985c
commit 1cb1a1f1dc

View file

@ -46,6 +46,10 @@ fn main() {
match parts.as_slice() {
[""] => {}
["fail"] => exit(1),
["dump", dest] => {
let dest_path = edit_script_path.parent().unwrap().join(dest);
fs::copy(&args.file, dest_path).unwrap();
}
["expect"] => {
let actual = String::from_utf8(fs::read(&args.file).unwrap()).unwrap();
if actual != payload {