diff --git a/src/libexpr-tests/error_traces.cc b/src/libexpr-tests/error_traces.cc index 974e4d281..e722cc484 100644 --- a/src/libexpr-tests/error_traces.cc +++ b/src/libexpr-tests/error_traces.cc @@ -139,76 +139,6 @@ TEST_F(ErrorTraceTest, NestedThrows) #define ASSERT_DERIVATION_TRACE3(args, type, message, context1, context2) \ ASSERT_TRACE4(args, type, message, context1, context2, DERIVATION_TRACE_HINTFMT("foo")) -TEST_F(ErrorTraceTest, genericClosure) -{ - ASSERT_TRACE2( - "genericClosure 1", - TypeError, - 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")); - - ASSERT_TRACE2( - "genericClosure {}", - TypeError, - HintFmt("attribute '%s' missing", "startSet"), - HintFmt("in the attrset passed as argument to builtins.genericClosure")); - - ASSERT_TRACE2( - "genericClosure { startSet = 1; }", - TypeError, - 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")); - - ASSERT_TRACE2( - "genericClosure { startSet = [{ key = 1;}]; operator = true; }", - TypeError, - 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")); - - ASSERT_TRACE3( - "genericClosure { startSet = [{ key = 1;}]; operator = item: true; }", - TypeError, - 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"), - HintFmt( - "while calling %s on genericClosure element %s", - "operator", - Uncolored("{ key = " ANSI_CYAN "1" ANSI_NORMAL "; }"))); - - ASSERT_TRACE3( - "genericClosure { startSet = [{ key = 1;}]; operator = item: [ true ]; }", - TypeError, - HintFmt("expected a set but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)), - HintFmt(""), - HintFmt("in genericClosure element %s", Uncolored(ANSI_CYAN "true" ANSI_NORMAL))); - - ASSERT_TRACE3( - "genericClosure { startSet = [{ key = 1;}]; operator = item: [ {} ]; }", - TypeError, - HintFmt("attribute '%s' missing", "key"), - HintFmt(""), - HintFmt("in genericClosure element %s", Uncolored("{ }"))); - - ASSERT_TRACE3( - "genericClosure { startSet = [{ key = 1;}]; operator = item: [{ key = ''a''; }]; }", - EvalError, - HintFmt( - "cannot compare %s with %s; values are %s and %s", - "a string", - "an integer", - Uncolored(ANSI_MAGENTA "\"a\"" ANSI_NORMAL), - Uncolored(ANSI_CYAN "1" ANSI_NORMAL)), - HintFmt("with element %s", Uncolored("{ key = " ANSI_CYAN "1" ANSI_NORMAL "; }")), - HintFmt("while comparing element %s", Uncolored("{ key = " ANSI_MAGENTA "\"a\"" ANSI_NORMAL "; }"))); - - ASSERT_TRACE3( - "genericClosure { startSet = [ true ]; operator = item: [{ key = ''a''; }]; }", - TypeError, - HintFmt("expected a set but found %s: %s", "a Boolean", Uncolored(ANSI_CYAN "true" ANSI_NORMAL)), - HintFmt(""), - HintFmt("in genericClosure element %s", Uncolored(ANSI_CYAN "true" ANSI_NORMAL))); -} - TEST_F(ErrorTraceTest, replaceStrings) { ASSERT_TRACE2(