mirror of
https://github.com/NixOS/nix
synced 2025-06-30 15:48:00 +02:00
Merge cee75fbf64
into 918ac6b2fc
This commit is contained in:
commit
8647f73d3a
2 changed files with 54 additions and 0 deletions
|
@ -4710,6 +4710,16 @@ static RegisterPrimOp primop_splitVersion({
|
|||
.fun = prim_splitVersion,
|
||||
});
|
||||
|
||||
static void prim_testThrowErrorMaybe(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
||||
{
|
||||
if (getEnv("_NIX_TEST_DO_THROW_ERROR") == "1") {
|
||||
state.error<EvalError>("this is a dummy error").atPos(pos).debugThrow();
|
||||
} else {
|
||||
state.forceValue(*args[0], pos);
|
||||
v = *args[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* Primop registration
|
||||
|
@ -4933,6 +4943,16 @@ void EvalState::createBaseEnv(const EvalSettings & evalSettings)
|
|||
.fun = settings.traceVerbose ? prim_trace : prim_second,
|
||||
});
|
||||
|
||||
if (getEnv("_NIX_TEST_PRIMOPS") == "1") {
|
||||
addPrimOp({
|
||||
.name = "__testThrowErrorMaybe",
|
||||
.args = { "e" },
|
||||
.arity = 1,
|
||||
.doc = "throw dummy error if _NIX_TEST_DO_THROW_ERROR == 1, return arg otherwise",
|
||||
.fun = prim_testThrowErrorMaybe
|
||||
});
|
||||
}
|
||||
|
||||
/* Add a value containing the current Nix expression search path. */
|
||||
auto list = buildList(lookupPath.elements.size());
|
||||
for (const auto & [n, i] : enumerate(lookupPath.elements)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue