refactor: tidy; fix runtime path resolution

This commit is contained in:
2026-01-17 13:45:44 +08:00
parent f2fc12026f
commit 09bfbca64a
21 changed files with 590 additions and 575 deletions

View File

@@ -110,10 +110,7 @@ fn test_path_with_file() {
let test_file = temp_dir.path().join("test.txt");
std::fs::write(&test_file, "Hello, World!").unwrap();
let expr = format!(
r#"builtins.path {{ path = {}; }}"#,
test_file.display()
);
let expr = format!(r#"builtins.path {{ path = {}; }}"#, test_file.display());
let result = ctx.eval_code(&expr).unwrap();
// Should return a store path string
@@ -239,10 +236,7 @@ fn test_path_with_sha256() {
std::fs::write(&test_file, "Test content for hashing").unwrap();
// First, get the hash by calling without sha256
let expr1 = format!(
r#"builtins.path {{ path = {}; }}"#,
test_file.display()
);
let expr1 = format!(r#"builtins.path {{ path = {}; }}"#, test_file.display());
let result1 = ctx.eval_code(&expr1).unwrap();
let store_path1 = match result1 {
Value::String(s) => s,
@@ -251,10 +245,7 @@ fn test_path_with_sha256() {
// Compute the actual hash (for testing, we'll just verify the same path is returned)
// In real usage, the user would know the hash beforehand
let expr2 = format!(
r#"builtins.path {{ path = {}; }}"#,
test_file.display()
);
let expr2 = format!(r#"builtins.path {{ path = {}; }}"#, test_file.display());
let result2 = ctx.eval_code(&expr2).unwrap();
let store_path2 = match result2 {
Value::String(s) => s,