2023-01-19 12:23:04 +00:00
|
|
|
#include <gmock/gmock.h>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2023-01-29 17:37:32 +00:00
|
|
|
#include "tests/libexpr.hh"
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
using namespace testing;
|
|
|
|
|
|
|
|
// Testing eval of PrimOp's
|
|
|
|
class ErrorTraceTest : public LibExprTest { };
|
|
|
|
|
2022-11-28 23:25:36 +00:00
|
|
|
TEST_F(ErrorTraceTest, TraceBuilder) {
|
|
|
|
ASSERT_THROW(
|
libexpr: Support structured error classes
While preparing PRs like #9753, I've had to change error messages in
dozens of code paths. It would be nice if instead of
EvalError("expected 'boolean' but found '%1%'", showType(v))
we could write
TypeError(v, "boolean")
or similar. Then, changing the error message could be a mechanical
refactor with the compiler pointing out places the constructor needs to
be changed, rather than the error-prone process of grepping through the
codebase. Structured errors would also help prevent the "same" error
from having multiple slightly different messages, and could be a first
step towards error codes / an error index.
This PR reworks the exception infrastructure in `libexpr` to
support exception types with different constructor signatures than
`BaseError`. Actually refactoring the exceptions to use structured data
will come in a future PR (this one is big enough already, as it has to
touch every exception in `libexpr`).
The core design is in `eval-error.hh`. Generally, errors like this:
state.error("'%s' is not a string", getAttrPathStr())
.debugThrow<TypeError>()
are transformed like this:
state.error<TypeError>("'%s' is not a string", getAttrPathStr())
.debugThrow()
The type annotation has moved from `ErrorBuilder::debugThrow` to
`EvalState::error`.
2024-01-23 01:08:29 +00:00
|
|
|
state.error<EvalError>("puppy").debugThrow(),
|
2022-11-28 23:25:36 +00:00
|
|
|
EvalError
|
|
|
|
);
|
|
|
|
|
|
|
|
ASSERT_THROW(
|
libexpr: Support structured error classes
While preparing PRs like #9753, I've had to change error messages in
dozens of code paths. It would be nice if instead of
EvalError("expected 'boolean' but found '%1%'", showType(v))
we could write
TypeError(v, "boolean")
or similar. Then, changing the error message could be a mechanical
refactor with the compiler pointing out places the constructor needs to
be changed, rather than the error-prone process of grepping through the
codebase. Structured errors would also help prevent the "same" error
from having multiple slightly different messages, and could be a first
step towards error codes / an error index.
This PR reworks the exception infrastructure in `libexpr` to
support exception types with different constructor signatures than
`BaseError`. Actually refactoring the exceptions to use structured data
will come in a future PR (this one is big enough already, as it has to
touch every exception in `libexpr`).
The core design is in `eval-error.hh`. Generally, errors like this:
state.error("'%s' is not a string", getAttrPathStr())
.debugThrow<TypeError>()
are transformed like this:
state.error<TypeError>("'%s' is not a string", getAttrPathStr())
.debugThrow()
The type annotation has moved from `ErrorBuilder::debugThrow` to
`EvalState::error`.
2024-01-23 01:08:29 +00:00
|
|
|
state.error<EvalError>("puppy").withTrace(noPos, "doggy").debugThrow(),
|
2022-11-28 23:25:36 +00:00
|
|
|
EvalError
|
|
|
|
);
|
|
|
|
|
|
|
|
ASSERT_THROW(
|
|
|
|
try {
|
|
|
|
try {
|
libexpr: Support structured error classes
While preparing PRs like #9753, I've had to change error messages in
dozens of code paths. It would be nice if instead of
EvalError("expected 'boolean' but found '%1%'", showType(v))
we could write
TypeError(v, "boolean")
or similar. Then, changing the error message could be a mechanical
refactor with the compiler pointing out places the constructor needs to
be changed, rather than the error-prone process of grepping through the
codebase. Structured errors would also help prevent the "same" error
from having multiple slightly different messages, and could be a first
step towards error codes / an error index.
This PR reworks the exception infrastructure in `libexpr` to
support exception types with different constructor signatures than
`BaseError`. Actually refactoring the exceptions to use structured data
will come in a future PR (this one is big enough already, as it has to
touch every exception in `libexpr`).
The core design is in `eval-error.hh`. Generally, errors like this:
state.error("'%s' is not a string", getAttrPathStr())
.debugThrow<TypeError>()
are transformed like this:
state.error<TypeError>("'%s' is not a string", getAttrPathStr())
.debugThrow()
The type annotation has moved from `ErrorBuilder::debugThrow` to
`EvalState::error`.
2024-01-23 01:08:29 +00:00
|
|
|
state.error<EvalError>("puppy").withTrace(noPos, "doggy").debugThrow();
|
2022-11-28 23:25:36 +00:00
|
|
|
} catch (Error & e) {
|
2024-02-08 23:55:20 +00:00
|
|
|
e.addTrace(state.positions[noPos], "beans");
|
2022-11-28 23:25:36 +00:00
|
|
|
throw;
|
|
|
|
}
|
|
|
|
} catch (BaseError & e) {
|
|
|
|
ASSERT_EQ(PrintToString(e.info().msg),
|
2024-02-04 04:35:19 +00:00
|
|
|
PrintToString(HintFmt("puppy")));
|
2022-11-28 23:25:36 +00:00
|
|
|
auto trace = e.info().traces.rbegin();
|
|
|
|
ASSERT_EQ(e.info().traces.size(), 2);
|
|
|
|
ASSERT_EQ(PrintToString(trace->hint),
|
2024-02-04 04:35:19 +00:00
|
|
|
PrintToString(HintFmt("doggy")));
|
2022-11-28 23:25:36 +00:00
|
|
|
trace++;
|
|
|
|
ASSERT_EQ(PrintToString(trace->hint),
|
2024-02-04 04:35:19 +00:00
|
|
|
PrintToString(HintFmt("beans")));
|
2022-11-28 23:25:36 +00:00
|
|
|
throw;
|
|
|
|
}
|
|
|
|
, EvalError
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-12-20 11:06:27 +00:00
|
|
|
TEST_F(ErrorTraceTest, NestedThrows) {
|
|
|
|
try {
|
libexpr: Support structured error classes
While preparing PRs like #9753, I've had to change error messages in
dozens of code paths. It would be nice if instead of
EvalError("expected 'boolean' but found '%1%'", showType(v))
we could write
TypeError(v, "boolean")
or similar. Then, changing the error message could be a mechanical
refactor with the compiler pointing out places the constructor needs to
be changed, rather than the error-prone process of grepping through the
codebase. Structured errors would also help prevent the "same" error
from having multiple slightly different messages, and could be a first
step towards error codes / an error index.
This PR reworks the exception infrastructure in `libexpr` to
support exception types with different constructor signatures than
`BaseError`. Actually refactoring the exceptions to use structured data
will come in a future PR (this one is big enough already, as it has to
touch every exception in `libexpr`).
The core design is in `eval-error.hh`. Generally, errors like this:
state.error("'%s' is not a string", getAttrPathStr())
.debugThrow<TypeError>()
are transformed like this:
state.error<TypeError>("'%s' is not a string", getAttrPathStr())
.debugThrow()
The type annotation has moved from `ErrorBuilder::debugThrow` to
`EvalState::error`.
2024-01-23 01:08:29 +00:00
|
|
|
state.error<EvalError>("puppy").withTrace(noPos, "doggy").debugThrow();
|
2022-12-20 11:06:27 +00:00
|
|
|
} catch (BaseError & e) {
|
|
|
|
try {
|
libexpr: Support structured error classes
While preparing PRs like #9753, I've had to change error messages in
dozens of code paths. It would be nice if instead of
EvalError("expected 'boolean' but found '%1%'", showType(v))
we could write
TypeError(v, "boolean")
or similar. Then, changing the error message could be a mechanical
refactor with the compiler pointing out places the constructor needs to
be changed, rather than the error-prone process of grepping through the
codebase. Structured errors would also help prevent the "same" error
from having multiple slightly different messages, and could be a first
step towards error codes / an error index.
This PR reworks the exception infrastructure in `libexpr` to
support exception types with different constructor signatures than
`BaseError`. Actually refactoring the exceptions to use structured data
will come in a future PR (this one is big enough already, as it has to
touch every exception in `libexpr`).
The core design is in `eval-error.hh`. Generally, errors like this:
state.error("'%s' is not a string", getAttrPathStr())
.debugThrow<TypeError>()
are transformed like this:
state.error<TypeError>("'%s' is not a string", getAttrPathStr())
.debugThrow()
The type annotation has moved from `ErrorBuilder::debugThrow` to
`EvalState::error`.
2024-01-23 01:08:29 +00:00
|
|
|
state.error<EvalError>("beans").debugThrow();
|
2022-12-20 11:06:27 +00:00
|
|
|
} catch (Error & e2) {
|
2024-02-08 23:55:20 +00:00
|
|
|
e.addTrace(state.positions[noPos], "beans2");
|
2024-02-04 04:35:19 +00:00
|
|
|
//e2.addTrace(state.positions[noPos], "Something", "");
|
2022-12-20 11:06:27 +00:00
|
|
|
ASSERT_TRUE(e.info().traces.size() == 2);
|
|
|
|
ASSERT_TRUE(e2.info().traces.size() == 0);
|
|
|
|
ASSERT_FALSE(&e.info() == &e2.info());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-11-28 23:25:36 +00:00
|
|
|
|
2023-01-19 12:23:04 +00:00
|
|
|
#define ASSERT_TRACE1(args, type, message) \
|
|
|
|
ASSERT_THROW( \
|
2022-11-28 23:25:36 +00:00
|
|
|
std::string expr(args); \
|
|
|
|
std::string name = expr.substr(0, expr.find(" ")); \
|
2023-01-19 12:23:04 +00:00
|
|
|
try { \
|
2022-11-28 23:25:36 +00:00
|
|
|
Value v = eval("builtins." args); \
|
|
|
|
state.forceValueDeep(v); \
|
2023-01-19 12:23:04 +00:00
|
|
|
} catch (BaseError & e) { \
|
|
|
|
ASSERT_EQ(PrintToString(e.info().msg), \
|
|
|
|
PrintToString(message)); \
|
2022-11-28 23:25:36 +00:00
|
|
|
ASSERT_EQ(e.info().traces.size(), 1) << "while testing " args << std::endl << e.what(); \
|
2023-01-19 12:23:04 +00:00
|
|
|
auto trace = e.info().traces.rbegin(); \
|
|
|
|
ASSERT_EQ(PrintToString(trace->hint), \
|
2024-02-04 04:35:19 +00:00
|
|
|
PrintToString(HintFmt("while calling the '%s' builtin", name))); \
|
2023-01-19 12:23:04 +00:00
|
|
|
throw; \
|
|
|
|
} \
|
|
|
|
, type \
|
|
|
|
)
|
|
|
|
|
|
|
|
#define ASSERT_TRACE2(args, type, message, context) \
|
|
|
|
ASSERT_THROW( \
|
2022-11-28 23:25:36 +00:00
|
|
|
std::string expr(args); \
|
|
|
|
std::string name = expr.substr(0, expr.find(" ")); \
|
2023-01-19 12:23:04 +00:00
|
|
|
try { \
|
2022-11-28 23:25:36 +00:00
|
|
|
Value v = eval("builtins." args); \
|
|
|
|
state.forceValueDeep(v); \
|
2023-01-19 12:23:04 +00:00
|
|
|
} catch (BaseError & e) { \
|
|
|
|
ASSERT_EQ(PrintToString(e.info().msg), \
|
|
|
|
PrintToString(message)); \
|
2022-11-28 23:25:36 +00:00
|
|
|
ASSERT_EQ(e.info().traces.size(), 2) << "while testing " args << std::endl << e.what(); \
|
2023-01-19 12:23:04 +00:00
|
|
|
auto trace = e.info().traces.rbegin(); \
|
|
|
|
ASSERT_EQ(PrintToString(trace->hint), \
|
|
|
|
PrintToString(context)); \
|
|
|
|
++trace; \
|
|
|
|
ASSERT_EQ(PrintToString(trace->hint), \
|
2024-02-04 04:35:19 +00:00
|
|
|
PrintToString(HintFmt("while calling the '%s' builtin", name))); \
|
2023-01-19 12:23:04 +00:00
|
|
|
throw; \
|
|
|
|
} \
|
|
|
|
, type \
|
|
|
|
)
|
|
|
|
|
2022-11-28 23:25:36 +00:00
|
|
|
TEST_F(ErrorTraceTest, genericClosure) {
|
2023-01-19 12:23:04 +00:00
|
|
|
ASSERT_TRACE2("genericClosure 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
2022-11-28 23:25:36 +00:00
|
|
|
ASSERT_TRACE2("genericClosure {}",
|
2023-01-19 12:23:04 +00:00
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attribute '%s' missing", "startSet"),
|
|
|
|
HintFmt("in the attrset passed as argument to builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genericClosure { startSet = 1; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the 'startSet' attribute passed as argument to builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = true; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the 'operator' attribute passed as argument to builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: true; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the `operator` passed to builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [ true ]; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating one of the elements generated by (or initially passed to) builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
2022-11-28 23:25:36 +00:00
|
|
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [ {} ]; }",
|
2023-01-19 12:23:04 +00:00
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attribute '%s' missing", "key"),
|
|
|
|
HintFmt("in one of the attrsets generated by (or initially passed to) builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [{ key = ''a''; }]; }",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot compare %s with %s", "a string", "an integer"),
|
|
|
|
HintFmt("while comparing the `key` attributes of two genericClosure elements"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genericClosure { startSet = [ true ]; operator = item: [{ key = ''a''; }]; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating one of the elements generated by (or initially passed to) builtins.genericClosure"));
|
2023-01-19 12:23:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, replaceStrings) {
|
|
|
|
ASSERT_TRACE2("replaceStrings 0 0 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "0" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.replaceStrings"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("replaceStrings [] 0 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "0" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.replaceStrings"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("replaceStrings [ 0 ] [] {}",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("'from' and 'to' arguments passed to builtins.replaceStrings have different lengths"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("replaceStrings [ 1 ] [ \"new\" ] {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating one of the strings to replace passed to builtins.replaceStrings"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
2023-05-25 04:37:00 +00:00
|
|
|
ASSERT_TRACE2("replaceStrings [ \"oo\" ] [ true ] \"foo\"",
|
2022-11-28 23:25:36 +00:00
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating one of the replacement strings passed to builtins.replaceStrings"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("replaceStrings [ \"old\" ] [ \"new\" ] {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the third argument passed to builtins.replaceStrings"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, scopedImport) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, import) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, typeOf) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isNull) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isFunction) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isInt) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isFloat) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isString) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isBool) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isPath) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, break) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, abort) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, throw) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, addErrorContext) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, ceil) {
|
|
|
|
ASSERT_TRACE2("ceil \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a float but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.ceil"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, floor) {
|
|
|
|
ASSERT_TRACE2("floor \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a float but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.floor"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, tryEval) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, getEnv) {
|
|
|
|
ASSERT_TRACE2("getEnv [ ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.getEnv"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, seq) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, deepSeq) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, trace) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, placeholder) {
|
|
|
|
ASSERT_TRACE2("placeholder []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.placeholder"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, toPath) {
|
|
|
|
ASSERT_TRACE2("toPath []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.toPath"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("toPath \"foo\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("string '%s' doesn't represent an absolute path", "foo"),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.toPath"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, storePath) {
|
|
|
|
ASSERT_TRACE2("storePath true",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to 'builtins.storePath'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, pathExists) {
|
|
|
|
ASSERT_TRACE2("pathExists []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while realising the context of a path"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("pathExists \"zorglub\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("string '%s' doesn't represent an absolute path", "zorglub"),
|
|
|
|
HintFmt("while realising the context of a path"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, baseNameOf) {
|
|
|
|
ASSERT_TRACE2("baseNameOf []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.baseNameOf"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, dirOf) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, readFile) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, findFile) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, hashFile) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, readDir) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, toXML) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, toJSON) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, fromJSON) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, toFile) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, filterSource) {
|
|
|
|
ASSERT_TRACE2("filterSource [] []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the second argument (the path to filter) passed to 'builtins.filterSource'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("filterSource [] \"foo\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("string '%s' doesn't represent an absolute path", "foo"),
|
|
|
|
HintFmt("while evaluating the second argument (the path to filter) passed to 'builtins.filterSource'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("filterSource [] ./.",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.filterSource"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// Usupported by store "dummy"
|
|
|
|
|
|
|
|
// ASSERT_TRACE2("filterSource (_: 1) ./.",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("attempt to call something which is not a function but %s", "an integer"),
|
|
|
|
// HintFmt("while adding path '/home/layus/projects/nix'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// ASSERT_TRACE2("filterSource (_: _: 1) ./.",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("expected a Boolean but found %s: %s", "an integer", "1"),
|
|
|
|
// HintFmt("while evaluating the return value of the path filter function"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, path) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, attrNames) {
|
|
|
|
ASSERT_TRACE2("attrNames []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the argument passed to builtins.attrNames"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, attrValues) {
|
|
|
|
ASSERT_TRACE2("attrValues []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the argument passed to builtins.attrValues"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, getAttr) {
|
|
|
|
ASSERT_TRACE2("getAttr [] []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.getAttr"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("getAttr \"foo\" []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.getAttr"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("getAttr \"foo\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attribute '%s' missing", "foo"),
|
|
|
|
HintFmt("in the attribute set under consideration"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, unsafeGetAttrPos) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, hasAttr) {
|
|
|
|
ASSERT_TRACE2("hasAttr [] []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.hasAttr"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("hasAttr \"foo\" []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.hasAttr"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isAttrs) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, removeAttrs) {
|
|
|
|
ASSERT_TRACE2("removeAttrs \"\" \"\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("removeAttrs \"\" [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("removeAttrs \"\" [ \"1\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, listToAttrs) {
|
|
|
|
ASSERT_TRACE2("listToAttrs 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the argument passed to builtins.listToAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("listToAttrs [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating an element of the list passed to builtins.listToAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("listToAttrs [ {} ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attribute '%s' missing", "name"),
|
|
|
|
HintFmt("in a {name=...; value=...;} pair"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("listToAttrs [ { name = 1; } ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the `name` attribute of an element of the list passed to builtins.listToAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("listToAttrs [ { name = \"foo\"; } ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attribute '%s' missing", "value"),
|
|
|
|
HintFmt("in a {name=...; value=...;} pair"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, intersectAttrs) {
|
|
|
|
ASSERT_TRACE2("intersectAttrs [] []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.intersectAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("intersectAttrs {} []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.intersectAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, catAttrs) {
|
|
|
|
ASSERT_TRACE2("catAttrs [] {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.catAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("catAttrs \"foo\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.catAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("catAttrs \"foo\" [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating an element in the list passed as second argument to builtins.catAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("catAttrs \"foo\" [ { foo = 1; } 1 { bar = 5;} ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating an element in the list passed as second argument to builtins.catAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, functionArgs) {
|
|
|
|
ASSERT_TRACE1("functionArgs {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("'functionArgs' requires a function"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, mapAttrs) {
|
|
|
|
ASSERT_TRACE2("mapAttrs [] []",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.mapAttrs"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// XXX: defered
|
|
|
|
// ASSERT_TRACE2("mapAttrs \"\" { foo.bar = 1; }",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("attempt to call something which is not a function but %s", "a string"),
|
|
|
|
// HintFmt("while evaluating the attribute 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// ASSERT_TRACE2("mapAttrs (x: x + \"1\") { foo.bar = 1; }",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("attempt to call something which is not a function but %s", "a string"),
|
|
|
|
// HintFmt("while evaluating the attribute 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// ASSERT_TRACE2("mapAttrs (x: y: x + 1) { foo.bar = 1; }",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("cannot coerce %s to a string", "an integer"),
|
|
|
|
// HintFmt("while evaluating a path segment"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, zipAttrsWith) {
|
|
|
|
ASSERT_TRACE2("zipAttrsWith [] [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "a list", Uncolored("[ ]")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.zipAttrsWith"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("zipAttrsWith (_: 1) [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating a value of the list passed as second argument to builtins.zipAttrsWith"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// XXX: How to properly tell that the fucntion takes two arguments ?
|
|
|
|
// The same question also applies to sort, and maybe others.
|
|
|
|
// Due to lazyness, we only create a thunk, and it fails later on.
|
|
|
|
// ASSERT_TRACE2("zipAttrsWith (_: 1) [ { foo = 1; } ]",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("attempt to call something which is not a function but %s", "an integer"),
|
|
|
|
// HintFmt("while evaluating the attribute 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// XXX: Also deferred deeply
|
|
|
|
// ASSERT_TRACE2("zipAttrsWith (a: b: a + b) [ { foo = 1; } { foo = 2; } ]",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("cannot coerce %s to a string", "a list"),
|
|
|
|
// HintFmt("while evaluating a path segment"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, isList) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, elemAt) {
|
|
|
|
ASSERT_TRACE2("elemAt \"foo\" (-1)",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.elemAt"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("elemAt [] (-1)",
|
|
|
|
Error,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("list index %d is out of bounds", -1));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("elemAt [\"foo\"] 3",
|
|
|
|
Error,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("list index %d is out of bounds", 3));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, head) {
|
|
|
|
ASSERT_TRACE2("head 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.elemAt"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("head []",
|
|
|
|
Error,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("list index %d is out of bounds", 0));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, tail) {
|
|
|
|
ASSERT_TRACE2("tail 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.tail"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("tail []",
|
|
|
|
Error,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("'tail' called on an empty list"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, map) {
|
|
|
|
ASSERT_TRACE2("map 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.map"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("map 1 [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.map"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, filter) {
|
|
|
|
ASSERT_TRACE2("filter 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.filter"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("filter 1 [ \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.filter"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("filter (_: 5) [ \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", Uncolored(ANSI_CYAN "5" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the filtering function passed to builtins.filter"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, elem) {
|
|
|
|
ASSERT_TRACE2("elem 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.elem"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, concatLists) {
|
|
|
|
ASSERT_TRACE2("concatLists 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.concatLists"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatLists [ 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating a value of the list passed to builtins.concatLists"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatLists [ [1] \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating a value of the list passed to builtins.concatLists"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, length) {
|
|
|
|
ASSERT_TRACE2("length 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.length"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("length \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.length"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, foldlPrime) {
|
|
|
|
ASSERT_TRACE2("foldl' 1 \"foo\" true",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.foldlStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("foldl' (_: 1) \"foo\" true",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the third argument passed to builtins.foldlStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("foldl' (_: 1) \"foo\" [ true ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attempt to call something which is not a function but %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("foldl' (a: b: a && b) \"foo\" [ true ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("in the left operand of the AND (&&) operator"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, any) {
|
|
|
|
ASSERT_TRACE2("any 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.any"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("any (_: 1) \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.any"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("any (_: 1) [ \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the function passed to builtins.any"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, all) {
|
|
|
|
ASSERT_TRACE2("all 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.all"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("all (_: 1) \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.all"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("all (_: 1) [ \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the function passed to builtins.all"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, genList) {
|
|
|
|
ASSERT_TRACE2("genList 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.genList"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("genList 1 2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
2024-02-08 23:55:20 +00:00
|
|
|
HintFmt("while evaluating the first argument passed to builtins.genList"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// XXX: defered
|
|
|
|
// ASSERT_TRACE2("genList (x: x + \"foo\") 2 #TODO",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("cannot add %s to an integer", "a string"),
|
|
|
|
// HintFmt("while evaluating anonymous lambda"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("genList false (-3)",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot create list of size %d", -3));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, sort) {
|
|
|
|
ASSERT_TRACE2("sort 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.sort"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("sort 1 [ \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.sort"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("sort (_: 1) [ \"foo\" \"bar\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attempt to call something which is not a function but %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("sort (_: _: 1) [ \"foo\" \"bar\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the sorting function passed to builtins.sort"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// XXX: Trace too deep, need better asserts
|
|
|
|
// ASSERT_TRACE1("sort (a: b: a <= b) [ \"foo\" {} ] # TODO",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("cannot compare %s with %s", "a string", "a set"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
// ASSERT_TRACE1("sort (a: b: a <= b) [ {} {} ] # TODO",
|
|
|
|
// TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
// HintFmt("cannot compare %s with %s; values of that type are incomparable", "a set", "a set"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, partition) {
|
|
|
|
ASSERT_TRACE2("partition 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.partition"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("partition (_: 1) \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.partition"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("partition (_: 1) [ \"foo\" ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the partition function passed to builtins.partition"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, groupBy) {
|
|
|
|
ASSERT_TRACE2("groupBy 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.groupBy"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("groupBy (_: 1) \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.groupBy"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("groupBy (x: x) [ \"foo\" \"bar\" 1 ]",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the grouping function passed to builtins.groupBy"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, concatMap) {
|
|
|
|
ASSERT_TRACE2("concatMap 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a function but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.concatMap"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatMap (x: 1) \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.concatMap"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatMap (x: 1) [ \"foo\" ] # TODO",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the function passed to builtins.concatMap"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatMap (x: \"foo\") [ 1 2 ] # TODO",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the return value of the function passed to builtins.concatMap"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, add) {
|
|
|
|
ASSERT_TRACE2("add \"foo\" 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument of the addition"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("add 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument of the addition"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, sub) {
|
|
|
|
ASSERT_TRACE2("sub \"foo\" 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument of the subtraction"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("sub 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument of the subtraction"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, mul) {
|
|
|
|
ASSERT_TRACE2("mul \"foo\" 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument of the multiplication"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("mul 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument of the multiplication"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, div) {
|
|
|
|
ASSERT_TRACE2("div \"foo\" 1 # TODO: an integer was expected -> a number",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first operand of the division"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("div 1 \"foo\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a float but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second operand of the division"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("div \"foo\" 0",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("division by zero"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, bitAnd) {
|
|
|
|
ASSERT_TRACE2("bitAnd 1.1 2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a float", Uncolored(ANSI_CYAN "1.1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.bitAnd"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("bitAnd 1 2.2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a float", Uncolored(ANSI_CYAN "2.2" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.bitAnd"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, bitOr) {
|
|
|
|
ASSERT_TRACE2("bitOr 1.1 2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a float", Uncolored(ANSI_CYAN "1.1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.bitOr"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("bitOr 1 2.2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a float", Uncolored(ANSI_CYAN "2.2" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.bitOr"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, bitXor) {
|
|
|
|
ASSERT_TRACE2("bitXor 1.1 2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a float", Uncolored(ANSI_CYAN "1.1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.bitXor"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("bitXor 1 2.2",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a float", Uncolored(ANSI_CYAN "2.2" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.bitXor"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, lessThan) {
|
|
|
|
ASSERT_TRACE1("lessThan 1 \"foo\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot compare %s with %s", "an integer", "a string"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("lessThan {} {}",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot compare %s with %s; values of that type are incomparable", "a set", "a set"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("lessThan [ 1 2 ] [ \"foo\" ]",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot compare %s with %s", "an integer", "a string"),
|
|
|
|
HintFmt("while comparing two list elements"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, toString) {
|
|
|
|
ASSERT_TRACE2("toString { a = 1; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", Uncolored("{ a = " ANSI_CYAN "1" ANSI_NORMAL "; }")),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.toString"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, substring) {
|
|
|
|
ASSERT_TRACE2("substring {} \"foo\" true",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the first argument (the start offset) passed to builtins.substring"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("substring 3 \"foo\" true",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected an integer but found %s: %s", "a string", Uncolored(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the second argument (the substring length) passed to builtins.substring"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("substring 0 3 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the third argument (the string) passed to builtins.substring"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("substring (-3) 3 \"sometext\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("negative start position in 'substring'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, stringLength) {
|
|
|
|
ASSERT_TRACE2("stringLength {} # TODO: context is missing ???",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the argument passed to builtins.stringLength"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, hashString) {
|
|
|
|
ASSERT_TRACE2("hashString 1 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.hashString"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("hashString \"foo\" \"content\"",
|
|
|
|
UsageError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("unknown hash algorithm '%s', expect 'md5', 'sha1', 'sha256', or 'sha512'", "foo"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("hashString \"sha256\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.hashString"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, match) {
|
|
|
|
ASSERT_TRACE2("match 1 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.match"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("match \"foo\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.match"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("match \"(.*\" \"\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("invalid regular expression '%s'", "(.*"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, split) {
|
|
|
|
ASSERT_TRACE2("split 1 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.split"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("split \"foo\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.split"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE1("split \"f(o*o\" \"1foo2\"",
|
|
|
|
EvalError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("invalid regular expression '%s'", "f(o*o"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, concatStringsSep) {
|
|
|
|
ASSERT_TRACE2("concatStringsSep 1 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument (the separator string) passed to builtins.concatStringsSep"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatStringsSep \"foo\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the second argument (the list of strings to concat) passed to builtins.concatStringsSep"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("concatStringsSep \"foo\" [ 1 2 {} ] # TODO: coerce to string is buggy",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating one element of the list of strings to concat passed to builtins.concatStringsSep"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, parseDrvName) {
|
|
|
|
ASSERT_TRACE2("parseDrvName 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.parseDrvName"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, compareVersions) {
|
|
|
|
ASSERT_TRACE2("compareVersions 1 {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.compareVersions"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("compareVersions \"abd\" {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "a set", Uncolored("{ }")),
|
|
|
|
HintFmt("while evaluating the second argument passed to builtins.compareVersions"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, splitVersion) {
|
|
|
|
ASSERT_TRACE2("splitVersion 1",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", Uncolored(ANSI_CYAN "1" ANSI_NORMAL)),
|
|
|
|
HintFmt("while evaluating the first argument passed to builtins.splitVersion"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ErrorTraceTest, traceVerbose) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* // Needs different ASSERTs
|
|
|
|
TEST_F(ErrorTraceTest, derivationStrict) {
|
|
|
|
ASSERT_TRACE2("derivationStrict \"\"",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a set but found %s: %s", "a string", "\"\""),
|
|
|
|
HintFmt("while evaluating the argument passed to builtins.derivationStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict {}",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("attribute '%s' missing", "name"),
|
|
|
|
HintFmt("in the attrset passed as argument to builtins.derivationStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = 1; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a string but found %s: %s", "an integer", "1"),
|
|
|
|
HintFmt("while evaluating the `name` attribute passed to builtins.derivationStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("required attribute 'builder' missing"),
|
|
|
|
HintFmt("while evaluating derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; __structuredAttrs = 15; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", "15"),
|
|
|
|
HintFmt("while evaluating the `__structuredAttrs` attribute passed to builtins.derivationStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; __ignoreNulls = 15; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "an integer", "15"),
|
|
|
|
HintFmt("while evaluating the `__ignoreNulls` attribute passed to builtins.derivationStrict"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; outputHashMode = 15; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("invalid value '15' for 'outputHashMode' attribute"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputHashMode' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; outputHashMode = \"custom\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("invalid value 'custom' for 'outputHashMode' attribute"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputHashMode' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = {}; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
|
|
|
HintFmt("while evaluating the attribute 'system' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = {}; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputs' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"drv\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("invalid derivation output name 'drv'"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputs' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = []; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("derivation cannot have an empty set of outputs"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputs' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = [ \"drv\" ]; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("invalid derivation output name 'drv'"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputs' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = [ \"out\" \"out\" ]; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("duplicate derivation output 'out'"),
|
|
|
|
HintFmt("while evaluating the attribute 'outputs' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; __contentAddressed = \"true\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "a string", "\"true\""),
|
|
|
|
HintFmt("while evaluating the attribute '__contentAddressed' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; __impure = \"true\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "a string", "\"true\""),
|
|
|
|
HintFmt("while evaluating the attribute '__impure' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; __impure = \"true\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a Boolean but found %s: %s", "a string", "\"true\""),
|
|
|
|
HintFmt("while evaluating the attribute '__impure' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; args = \"foo\"; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("expected a list but found %s: %s", "a string", "\"foo\""),
|
|
|
|
HintFmt("while evaluating the attribute 'args' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; args = [ {} ]; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
|
|
|
HintFmt("while evaluating an element of the argument list"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; args = [ \"a\" {} ]; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
|
|
|
HintFmt("while evaluating an element of the argument list"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
ASSERT_TRACE2("derivationStrict { name = \"foo\"; builder = 1; system = 1; outputs = \"out\"; FOO = {}; }",
|
|
|
|
TypeError,
|
2024-02-04 04:35:19 +00:00
|
|
|
HintFmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
|
|
|
HintFmt("while evaluating the attribute 'FOO' of derivation 'foo'"));
|
2022-11-28 23:25:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2023-01-19 12:23:04 +00:00
|
|
|
} /* namespace nix */
|