about summary refs log tree commit diff
path: root/tvix/derivation/src/tests
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-04T20·59+0100
committerflokli <flokli@flokli.de>2023-01-06T12·25+0000
commitd4603fc0af5f2be27716d4d3c3fc6c514c8ffbe9 (patch)
treecf213db418f8abb6b3f22c7f185e0cfb44ec5e41 /tvix/derivation/src/tests
parent87c80895cd7eb9fa7c09a343352f16b471f57fce (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')
-rw-r--r--tvix/derivation/src/tests/mod.rs6
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()
+    );
 }