diff options
Diffstat (limited to 'tvix/derivation/src/tests/mod.rs')
-rw-r--r-- | tvix/derivation/src/tests/mod.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tvix/derivation/src/tests/mod.rs b/tvix/derivation/src/tests/mod.rs index 800806926976..3d4aae3fe4d4 100644 --- a/tvix/derivation/src/tests/mod.rs +++ b/tvix/derivation/src/tests/mod.rs @@ -14,7 +14,8 @@ fn read_file(path: &str) -> String { return data; } -fn assert_derivation_ok(path_to_drv_file: &str) { +#[test_resources("src/tests/derivation_tests/*.drv")] +fn check_serizaliation(path_to_drv_file: &str) { let data = read_file(&format!("{}.json", path_to_drv_file)); let derivation: Derivation = serde_json::from_str(&data).expect("JSON was not well-formatted"); @@ -27,6 +28,11 @@ fn assert_derivation_ok(path_to_drv_file: &str) { } #[test_resources("src/tests/derivation_tests/*.drv")] -fn derivation_files_ok(path: &str) { - assert_derivation_ok(path); +fn check_to_string(path_to_drv_file: &str) { + let data = read_file(&format!("{}.json", path_to_drv_file)); + let derivation: Derivation = serde_json::from_str(&data).expect("JSON was not well-formatted"); + + let expected = read_file(path_to_drv_file); + + assert_eq!(expected, derivation.to_string()); } |