fix tests

This commit is contained in:
Félix Saparelli 2024-10-14 15:46:07 +13:00
parent 967d53dfc0
commit 0dafc4f260
No known key found for this signature in database

View file

@ -2,7 +2,7 @@
use std::num::{NonZeroI32, NonZeroI64}; use std::num::{NonZeroI32, NonZeroI64};
use snapbox::{assert_eq, file}; use snapbox::{assert_data_eq, file};
use watchexec_events::{ use watchexec_events::{
filekind::{CreateKind, FileEventKind as EventKind, ModifyKind, RemoveKind, RenameMode}, filekind::{CreateKind, FileEventKind as EventKind, ModifyKind, RemoveKind, RenameMode},
Event, FileType, Keyboard, ProcessEnd, Source, Tag, Event, FileType, Keyboard, ProcessEnd, Source, Tag,
@ -20,9 +20,9 @@ fn single() {
metadata: Default::default(), metadata: Default::default(),
}; };
assert_eq( assert_data_eq!(
file!["snapshots/single.json"],
serde_json::to_string_pretty(&single).unwrap(), serde_json::to_string_pretty(&single).unwrap(),
file!["snapshots/single.json"],
); );
assert_eq!( assert_eq!(
@ -54,9 +54,9 @@ fn array() {
}, },
]; ];
assert_eq( assert_data_eq!(
file!["snapshots/array.json"],
serde_json::to_string_pretty(array).unwrap(), serde_json::to_string_pretty(array).unwrap(),
file!["snapshots/array.json"],
); );
assert_eq!(parse_file("tests/snapshots/array.json"), array); assert_eq!(parse_file("tests/snapshots/array.json"), array);
@ -73,9 +73,9 @@ fn metadata() {
.into(), .into(),
}]; }];
assert_eq( assert_data_eq!(
file!["snapshots/metadata.json"],
serde_json::to_string_pretty(metadata).unwrap(), serde_json::to_string_pretty(metadata).unwrap(),
file!["snapshots/metadata.json"],
); );
assert_eq!(parse_file("tests/snapshots/metadata.json"), metadata); assert_eq!(parse_file("tests/snapshots/metadata.json"), metadata);
@ -136,9 +136,9 @@ fn sources() {
}, },
]; ];
assert_eq( assert_data_eq!(
file!["snapshots/sources.json"],
serde_json::to_string_pretty(&sources).unwrap(), serde_json::to_string_pretty(&sources).unwrap(),
file!["snapshots/sources.json"],
); );
assert_eq!(parse_file("tests/snapshots/sources.json"), sources); assert_eq!(parse_file("tests/snapshots/sources.json"), sources);
@ -164,9 +164,9 @@ fn signals() {
}, },
]; ];
assert_eq( assert_data_eq!(
file!["snapshots/signals.json"],
serde_json::to_string_pretty(&signals).unwrap(), serde_json::to_string_pretty(&signals).unwrap(),
file!["snapshots/signals.json"],
); );
assert_eq!(parse_file("tests/snapshots/signals.json"), signals); assert_eq!(parse_file("tests/snapshots/signals.json"), signals);
@ -195,9 +195,9 @@ fn completions() {
}, },
]; ];
assert_eq( assert_data_eq!(
file!["snapshots/completions.json"],
serde_json::to_string_pretty(&completions).unwrap(), serde_json::to_string_pretty(&completions).unwrap(),
file!["snapshots/completions.json"],
); );
assert_eq!(parse_file("tests/snapshots/completions.json"), completions); assert_eq!(parse_file("tests/snapshots/completions.json"), completions);
@ -246,9 +246,9 @@ fn paths() {
}, },
]; ];
assert_eq( assert_data_eq!(
file!["snapshots/paths.json"],
serde_json::to_string_pretty(&paths).unwrap(), serde_json::to_string_pretty(&paths).unwrap(),
file!["snapshots/paths.json"],
); );
assert_eq!(parse_file("tests/snapshots/paths.json"), paths); assert_eq!(parse_file("tests/snapshots/paths.json"), paths);