diff options
author | Florian Klink <flokli@flokli.de> | 2023-01-04T20·59+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-01-06T12·25+0000 |
commit | d4603fc0af5f2be27716d4d3c3fc6c514c8ffbe9 (patch) | |
tree | cf213db418f8abb6b3f22c7f185e0cfb44ec5e41 /tvix/derivation/src/tests/mod.rs | |
parent | 87c80895cd7eb9fa7c09a343352f16b471f57fce (diff) |
refactor(derivation): return NixPath in calculate_derivation_path r/5608
This moves all the hash compression logic into a common helper function. Also update the docstring, which said "path" here, which could have been confused with output paths. Change-Id: Iedfb59aeb24f7638afac669dcd18d57b6cfaece2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7759 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation/src/tests/mod.rs')
-rw-r--r-- | tvix/derivation/src/tests/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tvix/derivation/src/tests/mod.rs b/tvix/derivation/src/tests/mod.rs index 1b55c6e3e751..623cc4e5b13a 100644 --- a/tvix/derivation/src/tests/mod.rs +++ b/tvix/derivation/src/tests/mod.rs @@ -4,6 +4,7 @@ use std::io::Read; use std::path::Path; use test_case::test_case; use test_generator::test_resources; +use tvix_store::nixpath::NixPath; const RESOURCES_PATHS: &str = "src/tests/derivation_tests"; @@ -61,5 +62,8 @@ fn derivation_path(name: &str, expected_path: &str) { let data = read_file(&format!("{}/{}.json", RESOURCES_PATHS, expected_path)); let derivation: Derivation = serde_json::from_str(&data).expect("JSON was not well-formatted"); - assert_eq!(derivation.calculate_derivation_path(name), expected_path); + assert_eq!( + derivation.calculate_derivation_path(name).unwrap(), + NixPath::from_string(expected_path).unwrap() + ); } |