mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-28 08:36:15 +02:00
Fix eval tests
This commit is contained in:
parent
087584ef4d
commit
95e4376434
4 changed files with 21 additions and 13 deletions
|
@ -1461,12 +1461,15 @@ static RegisterPrimOp primop_baseNameOf({
|
||||||
static void prim_dirOf(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
static void prim_dirOf(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
PathSet context;
|
PathSet context;
|
||||||
|
state.forceValue(*args[0], pos);
|
||||||
|
if (args[0]->type() == nPath) {
|
||||||
|
auto path = args[0]->path();
|
||||||
|
v.mkPath({path.accessor, dirOf(path.path)});
|
||||||
|
} else {
|
||||||
auto path = state.coerceToString(pos, *args[0], context, false, false);
|
auto path = state.coerceToString(pos, *args[0], context, false, false);
|
||||||
auto dir = dirOf(*path);
|
auto dir = dirOf(*path);
|
||||||
abort();
|
v.mkString(dir, context);
|
||||||
#if 0
|
}
|
||||||
if (args[0]->type() == nPath) v.mkPath(dir); else v.mkString(dir, context);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPrimOp primop_dirOf({
|
static RegisterPrimOp primop_dirOf({
|
||||||
|
|
|
@ -57,6 +57,7 @@ namespace nix {
|
||||||
ASSERT_EQ(getJSONValue(v), "\"test\\\"\"");
|
ASSERT_EQ(getJSONValue(v), "\"test\\\"\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// The dummy store doesn't support writing files. Fails with this exception message:
|
// The dummy store doesn't support writing files. Fails with this exception message:
|
||||||
// C++ exception with description "error: operation 'addToStoreFromDump' is
|
// C++ exception with description "error: operation 'addToStoreFromDump' is
|
||||||
// not supported by store 'dummy'" thrown in the test body.
|
// not supported by store 'dummy'" thrown in the test body.
|
||||||
|
@ -65,4 +66,5 @@ namespace nix {
|
||||||
v.mkPath("test");
|
v.mkPath("test");
|
||||||
ASSERT_EQ(getJSONValue(v), "\"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x\"");
|
ASSERT_EQ(getJSONValue(v), "\"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x\"");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} /* namespace nix */
|
} /* namespace nix */
|
||||||
|
|
|
@ -102,10 +102,13 @@ namespace nix {
|
||||||
if (arg.type() != nPath) {
|
if (arg.type() != nPath) {
|
||||||
*result_listener << "Expected a path got " << arg.type();
|
*result_listener << "Expected a path got " << arg.type();
|
||||||
return false;
|
return false;
|
||||||
} else if (std::string_view(arg.string.s) != p) {
|
} else {
|
||||||
*result_listener << "Expected a path that equals \"" << p << "\" but got: " << arg.string.s;
|
auto path = arg.path();
|
||||||
|
if (path.path != p) {
|
||||||
|
*result_listener << "Expected a path that equals \"" << p << "\" but got: " << path.path;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ libexpr-tests_INSTALL_DIR :=
|
||||||
|
|
||||||
libexpr-tests_SOURCES := $(wildcard $(d)/*.cc)
|
libexpr-tests_SOURCES := $(wildcard $(d)/*.cc)
|
||||||
|
|
||||||
libexpr-tests_CXXFLAGS += -I src/libexpr -I src/libutil -I src/libstore -I src/libexpr/tests
|
libexpr-tests_CXXFLAGS += -I src/libexpr -I src/libutil -I src/libstore -I src/libexpr/tests -I src/libfetchers
|
||||||
|
|
||||||
libexpr-tests_LIBS = libexpr libutil libstore libfetchers
|
libexpr-tests_LIBS = libexpr libutil libstore libfetchers
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue