refactor(tvix/eval): move mocked builtins.derivation to tests
This placeholder should not live in the main crate anymore as we will be injecting the real one from outside of eval, but there are still language tests that depend on a (simple, mockable) version of it. Change-Id: I68ea169db15cbdbeed320930d3069e21e376c90d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7783 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
37883389bc
commit
6b6bd30772
2 changed files with 38 additions and 36 deletions
|
|
@ -945,7 +945,7 @@ mod pure_builtins {
|
|||
}
|
||||
}
|
||||
|
||||
fn builtin_tuple(builtin: Builtin) -> (&'static str, Value) {
|
||||
pub(crate) fn builtin_tuple(builtin: Builtin) -> (&'static str, Value) {
|
||||
(builtin.name(), Value::Builtin(builtin))
|
||||
}
|
||||
|
||||
|
|
@ -1036,39 +1036,6 @@ pub fn placeholders() -> Vec<(&'static str, Value)> {
|
|||
Ok(Value::attrs(NixAttrs::from_iter(res.into_iter())))
|
||||
},
|
||||
),
|
||||
Builtin::new(
|
||||
"derivation",
|
||||
&[BuiltinArgument {
|
||||
strict: true,
|
||||
name: "attrs",
|
||||
}],
|
||||
None,
|
||||
|args: Vec<Value>, vm: &mut VM| {
|
||||
vm.emit_warning(WarningKind::NotImplemented("builtins.derivation"));
|
||||
|
||||
// We do not implement derivations yet, so this function sets mock
|
||||
// values on the fields that a real derivation would contain.
|
||||
//
|
||||
// Crucially this means we do not yet *validate* the values either.
|
||||
let input = args[0].to_attrs()?;
|
||||
let attrs = input.update(NixAttrs::from_iter(
|
||||
[
|
||||
(
|
||||
"outPath",
|
||||
"/nix/store/00000000000000000000000000000000-mock",
|
||||
),
|
||||
(
|
||||
"drvPath",
|
||||
"/nix/store/00000000000000000000000000000000-mock.drv",
|
||||
),
|
||||
("type", "derivation"),
|
||||
]
|
||||
.into_iter(),
|
||||
));
|
||||
|
||||
Ok(Value::Attrs(Box::new(attrs)))
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
ph.into_iter().map(builtin_tuple).collect()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue