From d4603fc0af5f2be27716d4d3c3fc6c514c8ffbe9 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 4 Jan 2023 21:59:23 +0100 Subject: refactor(derivation): return NixPath in calculate_derivation_path 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 Tested-by: BuildkiteCI --- tvix/derivation/src/tests/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tvix/derivation/src/tests') 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() + ); } -- cgit 1.4.1