mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
Don't print values in magenta
This fixes the opening bracket of lists/attrsets being printed in magenta, unlike the closing bracket. https://github.com/NixOS/nix/pull/9753#issuecomment-1904616088
This commit is contained in:
parent
49cf090cb2
commit
9646d62b0c
3 changed files with 131 additions and 114 deletions
|
@ -511,4 +511,11 @@ std::ostream & operator<<(std::ostream & output, const ValuePrinter & printer)
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
hintformat & hintformat::operator%(const ValuePrinter & value)
|
||||||
|
{
|
||||||
|
fmt % value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "fmt.hh"
|
||||||
#include "print-options.hh"
|
#include "print-options.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
@ -78,4 +79,13 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream & operator<<(std::ostream & output, const ValuePrinter & printer);
|
std::ostream & operator<<(std::ostream & output, const ValuePrinter & printer);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `ValuePrinter` does its own ANSI formatting, so we don't color it
|
||||||
|
* magenta.
|
||||||
|
*/
|
||||||
|
template<>
|
||||||
|
hintformat & hintformat::operator%(const ValuePrinter & value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, genericClosure) {
|
TEST_F(ErrorTraceTest, genericClosure) {
|
||||||
ASSERT_TRACE2("genericClosure 1",
|
ASSERT_TRACE2("genericClosure 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.genericClosure"));
|
hintfmt("while evaluating the first argument passed to builtins.genericClosure"));
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure {}",
|
ASSERT_TRACE2("genericClosure {}",
|
||||||
|
@ -115,22 +115,22 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure { startSet = 1; }",
|
ASSERT_TRACE2("genericClosure { startSet = 1; }",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the 'startSet' attribute passed as argument to builtins.genericClosure"));
|
hintfmt("while evaluating the 'startSet' attribute passed as argument to builtins.genericClosure"));
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = true; }",
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = true; }",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the 'operator' attribute passed as argument to builtins.genericClosure"));
|
hintfmt("while evaluating the 'operator' attribute passed as argument to builtins.genericClosure"));
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: true; }",
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: true; }",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the `operator` passed to builtins.genericClosure"));
|
hintfmt("while evaluating the return value of the `operator` passed to builtins.genericClosure"));
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [ true ]; }",
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [ true ]; }",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating one of the elements generated by (or initially passed to) builtins.genericClosure"));
|
hintfmt("while evaluating one of the elements generated by (or initially passed to) builtins.genericClosure"));
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [ {} ]; }",
|
ASSERT_TRACE2("genericClosure { startSet = [{ key = 1;}]; operator = item: [ {} ]; }",
|
||||||
|
@ -145,7 +145,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE2("genericClosure { startSet = [ true ]; operator = item: [{ key = ''a''; }]; }",
|
ASSERT_TRACE2("genericClosure { startSet = [ true ]; operator = item: [{ key = ''a''; }]; }",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating one of the elements generated by (or initially passed to) builtins.genericClosure"));
|
hintfmt("while evaluating one of the elements generated by (or initially passed to) builtins.genericClosure"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -154,12 +154,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, replaceStrings) {
|
TEST_F(ErrorTraceTest, replaceStrings) {
|
||||||
ASSERT_TRACE2("replaceStrings 0 0 {}",
|
ASSERT_TRACE2("replaceStrings 0 0 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "0" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "0" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.replaceStrings"));
|
hintfmt("while evaluating the first argument passed to builtins.replaceStrings"));
|
||||||
|
|
||||||
ASSERT_TRACE2("replaceStrings [] 0 {}",
|
ASSERT_TRACE2("replaceStrings [] 0 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "0" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "0" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.replaceStrings"));
|
hintfmt("while evaluating the second argument passed to builtins.replaceStrings"));
|
||||||
|
|
||||||
ASSERT_TRACE1("replaceStrings [ 0 ] [] {}",
|
ASSERT_TRACE1("replaceStrings [ 0 ] [] {}",
|
||||||
|
@ -168,17 +168,17 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE2("replaceStrings [ 1 ] [ \"new\" ] {}",
|
ASSERT_TRACE2("replaceStrings [ 1 ] [ \"new\" ] {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating one of the strings to replace passed to builtins.replaceStrings"));
|
hintfmt("while evaluating one of the strings to replace passed to builtins.replaceStrings"));
|
||||||
|
|
||||||
ASSERT_TRACE2("replaceStrings [ \"oo\" ] [ true ] \"foo\"",
|
ASSERT_TRACE2("replaceStrings [ \"oo\" ] [ true ] \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating one of the replacement strings passed to builtins.replaceStrings"));
|
hintfmt("while evaluating one of the replacement strings passed to builtins.replaceStrings"));
|
||||||
|
|
||||||
ASSERT_TRACE2("replaceStrings [ \"old\" ] [ \"new\" ] {}",
|
ASSERT_TRACE2("replaceStrings [ \"old\" ] [ \"new\" ] {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a string but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the third argument passed to builtins.replaceStrings"));
|
hintfmt("while evaluating the third argument passed to builtins.replaceStrings"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, ceil) {
|
TEST_F(ErrorTraceTest, ceil) {
|
||||||
ASSERT_TRACE2("ceil \"foo\"",
|
ASSERT_TRACE2("ceil \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a float but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a float but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.ceil"));
|
hintfmt("while evaluating the first argument passed to builtins.ceil"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, floor) {
|
TEST_F(ErrorTraceTest, floor) {
|
||||||
ASSERT_TRACE2("floor \"foo\"",
|
ASSERT_TRACE2("floor \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a float but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a float but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.floor"));
|
hintfmt("while evaluating the first argument passed to builtins.floor"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, getEnv) {
|
TEST_F(ErrorTraceTest, getEnv) {
|
||||||
ASSERT_TRACE2("getEnv [ ]",
|
ASSERT_TRACE2("getEnv [ ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a string but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.getEnv"));
|
hintfmt("while evaluating the first argument passed to builtins.getEnv"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, placeholder) {
|
TEST_F(ErrorTraceTest, placeholder) {
|
||||||
ASSERT_TRACE2("placeholder []",
|
ASSERT_TRACE2("placeholder []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a string but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.placeholder"));
|
hintfmt("while evaluating the first argument passed to builtins.placeholder"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, toPath) {
|
TEST_F(ErrorTraceTest, toPath) {
|
||||||
ASSERT_TRACE2("toPath []",
|
ASSERT_TRACE2("toPath []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a list", "[ ]"),
|
hintfmt("cannot coerce %s to a string: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.toPath"));
|
hintfmt("while evaluating the first argument passed to builtins.toPath"));
|
||||||
|
|
||||||
ASSERT_TRACE2("toPath \"foo\"",
|
ASSERT_TRACE2("toPath \"foo\"",
|
||||||
|
@ -309,7 +309,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, storePath) {
|
TEST_F(ErrorTraceTest, storePath) {
|
||||||
ASSERT_TRACE2("storePath true",
|
ASSERT_TRACE2("storePath true",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("cannot coerce %s to a string: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to 'builtins.storePath'"));
|
hintfmt("while evaluating the first argument passed to 'builtins.storePath'"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, pathExists) {
|
TEST_F(ErrorTraceTest, pathExists) {
|
||||||
ASSERT_TRACE2("pathExists []",
|
ASSERT_TRACE2("pathExists []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a list", "[ ]"),
|
hintfmt("cannot coerce %s to a string: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while realising the context of a path"));
|
hintfmt("while realising the context of a path"));
|
||||||
|
|
||||||
ASSERT_TRACE2("pathExists \"zorglub\"",
|
ASSERT_TRACE2("pathExists \"zorglub\"",
|
||||||
|
@ -332,7 +332,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, baseNameOf) {
|
TEST_F(ErrorTraceTest, baseNameOf) {
|
||||||
ASSERT_TRACE2("baseNameOf []",
|
ASSERT_TRACE2("baseNameOf []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a list", "[ ]"),
|
hintfmt("cannot coerce %s to a string: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.baseNameOf"));
|
hintfmt("while evaluating the first argument passed to builtins.baseNameOf"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, filterSource) {
|
TEST_F(ErrorTraceTest, filterSource) {
|
||||||
ASSERT_TRACE2("filterSource [] []",
|
ASSERT_TRACE2("filterSource [] []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a list", "[ ]"),
|
hintfmt("cannot coerce %s to a string: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the second argument (the path to filter) passed to 'builtins.filterSource'"));
|
hintfmt("while evaluating the second argument (the path to filter) passed to 'builtins.filterSource'"));
|
||||||
|
|
||||||
ASSERT_TRACE2("filterSource [] \"foo\"",
|
ASSERT_TRACE2("filterSource [] \"foo\"",
|
||||||
|
@ -387,7 +387,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE2("filterSource [] ./.",
|
ASSERT_TRACE2("filterSource [] ./.",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a function but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.filterSource"));
|
hintfmt("while evaluating the first argument passed to builtins.filterSource"));
|
||||||
|
|
||||||
// Usupported by store "dummy"
|
// Usupported by store "dummy"
|
||||||
|
@ -412,7 +412,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, attrNames) {
|
TEST_F(ErrorTraceTest, attrNames) {
|
||||||
ASSERT_TRACE2("attrNames []",
|
ASSERT_TRACE2("attrNames []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the argument passed to builtins.attrNames"));
|
hintfmt("while evaluating the argument passed to builtins.attrNames"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, attrValues) {
|
TEST_F(ErrorTraceTest, attrValues) {
|
||||||
ASSERT_TRACE2("attrValues []",
|
ASSERT_TRACE2("attrValues []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the argument passed to builtins.attrValues"));
|
hintfmt("while evaluating the argument passed to builtins.attrValues"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -430,12 +430,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, getAttr) {
|
TEST_F(ErrorTraceTest, getAttr) {
|
||||||
ASSERT_TRACE2("getAttr [] []",
|
ASSERT_TRACE2("getAttr [] []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a string but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.getAttr"));
|
hintfmt("while evaluating the first argument passed to builtins.getAttr"));
|
||||||
|
|
||||||
ASSERT_TRACE2("getAttr \"foo\" []",
|
ASSERT_TRACE2("getAttr \"foo\" []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.getAttr"));
|
hintfmt("while evaluating the second argument passed to builtins.getAttr"));
|
||||||
|
|
||||||
ASSERT_TRACE2("getAttr \"foo\" {}",
|
ASSERT_TRACE2("getAttr \"foo\" {}",
|
||||||
|
@ -453,12 +453,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, hasAttr) {
|
TEST_F(ErrorTraceTest, hasAttr) {
|
||||||
ASSERT_TRACE2("hasAttr [] []",
|
ASSERT_TRACE2("hasAttr [] []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a string but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.hasAttr"));
|
hintfmt("while evaluating the first argument passed to builtins.hasAttr"));
|
||||||
|
|
||||||
ASSERT_TRACE2("hasAttr \"foo\" []",
|
ASSERT_TRACE2("hasAttr \"foo\" []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.hasAttr"));
|
hintfmt("while evaluating the second argument passed to builtins.hasAttr"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -471,17 +471,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, removeAttrs) {
|
TEST_F(ErrorTraceTest, removeAttrs) {
|
||||||
ASSERT_TRACE2("removeAttrs \"\" \"\"",
|
ASSERT_TRACE2("removeAttrs \"\" \"\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a string", ANSI_MAGENTA "\"\"" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
hintfmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("removeAttrs \"\" [ 1 ]",
|
ASSERT_TRACE2("removeAttrs \"\" [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a string", ANSI_MAGENTA "\"\"" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
hintfmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("removeAttrs \"\" [ \"1\" ]",
|
ASSERT_TRACE2("removeAttrs \"\" [ \"1\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a string", ANSI_MAGENTA "\"\"" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
hintfmt("while evaluating the first argument passed to builtins.removeAttrs"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -490,12 +490,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, listToAttrs) {
|
TEST_F(ErrorTraceTest, listToAttrs) {
|
||||||
ASSERT_TRACE2("listToAttrs 1",
|
ASSERT_TRACE2("listToAttrs 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the argument passed to builtins.listToAttrs"));
|
hintfmt("while evaluating the argument passed to builtins.listToAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("listToAttrs [ 1 ]",
|
ASSERT_TRACE2("listToAttrs [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating an element of the list passed to builtins.listToAttrs"));
|
hintfmt("while evaluating an element of the list passed to builtins.listToAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("listToAttrs [ {} ]",
|
ASSERT_TRACE2("listToAttrs [ {} ]",
|
||||||
|
@ -505,7 +505,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE2("listToAttrs [ { name = 1; } ]",
|
ASSERT_TRACE2("listToAttrs [ { name = 1; } ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the `name` attribute of an element of the list passed to builtins.listToAttrs"));
|
hintfmt("while evaluating the `name` attribute of an element of the list passed to builtins.listToAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("listToAttrs [ { name = \"foo\"; } ]",
|
ASSERT_TRACE2("listToAttrs [ { name = \"foo\"; } ]",
|
||||||
|
@ -519,12 +519,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, intersectAttrs) {
|
TEST_F(ErrorTraceTest, intersectAttrs) {
|
||||||
ASSERT_TRACE2("intersectAttrs [] []",
|
ASSERT_TRACE2("intersectAttrs [] []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.intersectAttrs"));
|
hintfmt("while evaluating the first argument passed to builtins.intersectAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("intersectAttrs {} []",
|
ASSERT_TRACE2("intersectAttrs {} []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.intersectAttrs"));
|
hintfmt("while evaluating the second argument passed to builtins.intersectAttrs"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -533,22 +533,22 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, catAttrs) {
|
TEST_F(ErrorTraceTest, catAttrs) {
|
||||||
ASSERT_TRACE2("catAttrs [] {}",
|
ASSERT_TRACE2("catAttrs [] {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a string but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.catAttrs"));
|
hintfmt("while evaluating the first argument passed to builtins.catAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("catAttrs \"foo\" {}",
|
ASSERT_TRACE2("catAttrs \"foo\" {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a list but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.catAttrs"));
|
hintfmt("while evaluating the second argument passed to builtins.catAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("catAttrs \"foo\" [ 1 ]",
|
ASSERT_TRACE2("catAttrs \"foo\" [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating an element in the list passed as second argument to builtins.catAttrs"));
|
hintfmt("while evaluating an element in the list passed as second argument to builtins.catAttrs"));
|
||||||
|
|
||||||
ASSERT_TRACE2("catAttrs \"foo\" [ { foo = 1; } 1 { bar = 5;} ]",
|
ASSERT_TRACE2("catAttrs \"foo\" [ { foo = 1; } 1 { bar = 5;} ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating an element in the list passed as second argument to builtins.catAttrs"));
|
hintfmt("while evaluating an element in the list passed as second argument to builtins.catAttrs"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, mapAttrs) {
|
TEST_F(ErrorTraceTest, mapAttrs) {
|
||||||
ASSERT_TRACE2("mapAttrs [] []",
|
ASSERT_TRACE2("mapAttrs [] []",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a set but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.mapAttrs"));
|
hintfmt("while evaluating the second argument passed to builtins.mapAttrs"));
|
||||||
|
|
||||||
// XXX: defered
|
// XXX: defered
|
||||||
|
@ -590,12 +590,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, zipAttrsWith) {
|
TEST_F(ErrorTraceTest, zipAttrsWith) {
|
||||||
ASSERT_TRACE2("zipAttrsWith [] [ 1 ]",
|
ASSERT_TRACE2("zipAttrsWith [] [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "a list", "[ ]"),
|
hintfmt("expected a function but found %s: %s", "a list", normaltxt("[ ]")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.zipAttrsWith"));
|
hintfmt("while evaluating the first argument passed to builtins.zipAttrsWith"));
|
||||||
|
|
||||||
ASSERT_TRACE2("zipAttrsWith (_: 1) [ 1 ]",
|
ASSERT_TRACE2("zipAttrsWith (_: 1) [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a set but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a set but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating a value of the list passed as second argument to builtins.zipAttrsWith"));
|
hintfmt("while evaluating a value of the list passed as second argument to builtins.zipAttrsWith"));
|
||||||
|
|
||||||
// XXX: How to properly tell that the fucntion takes two arguments ?
|
// XXX: How to properly tell that the fucntion takes two arguments ?
|
||||||
|
@ -622,7 +622,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, elemAt) {
|
TEST_F(ErrorTraceTest, elemAt) {
|
||||||
ASSERT_TRACE2("elemAt \"foo\" (-1)",
|
ASSERT_TRACE2("elemAt \"foo\" (-1)",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.elemAt"));
|
hintfmt("while evaluating the first argument passed to builtins.elemAt"));
|
||||||
|
|
||||||
ASSERT_TRACE1("elemAt [] (-1)",
|
ASSERT_TRACE1("elemAt [] (-1)",
|
||||||
|
@ -639,7 +639,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, head) {
|
TEST_F(ErrorTraceTest, head) {
|
||||||
ASSERT_TRACE2("head 1",
|
ASSERT_TRACE2("head 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.elemAt"));
|
hintfmt("while evaluating the first argument passed to builtins.elemAt"));
|
||||||
|
|
||||||
ASSERT_TRACE1("head []",
|
ASSERT_TRACE1("head []",
|
||||||
|
@ -652,7 +652,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, tail) {
|
TEST_F(ErrorTraceTest, tail) {
|
||||||
ASSERT_TRACE2("tail 1",
|
ASSERT_TRACE2("tail 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.tail"));
|
hintfmt("while evaluating the first argument passed to builtins.tail"));
|
||||||
|
|
||||||
ASSERT_TRACE1("tail []",
|
ASSERT_TRACE1("tail []",
|
||||||
|
@ -665,12 +665,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, map) {
|
TEST_F(ErrorTraceTest, map) {
|
||||||
ASSERT_TRACE2("map 1 \"foo\"",
|
ASSERT_TRACE2("map 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.map"));
|
hintfmt("while evaluating the second argument passed to builtins.map"));
|
||||||
|
|
||||||
ASSERT_TRACE2("map 1 [ 1 ]",
|
ASSERT_TRACE2("map 1 [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.map"));
|
hintfmt("while evaluating the first argument passed to builtins.map"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -679,17 +679,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, filter) {
|
TEST_F(ErrorTraceTest, filter) {
|
||||||
ASSERT_TRACE2("filter 1 \"foo\"",
|
ASSERT_TRACE2("filter 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.filter"));
|
hintfmt("while evaluating the second argument passed to builtins.filter"));
|
||||||
|
|
||||||
ASSERT_TRACE2("filter 1 [ \"foo\" ]",
|
ASSERT_TRACE2("filter 1 [ \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.filter"));
|
hintfmt("while evaluating the first argument passed to builtins.filter"));
|
||||||
|
|
||||||
ASSERT_TRACE2("filter (_: 5) [ \"foo\" ]",
|
ASSERT_TRACE2("filter (_: 5) [ \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a Boolean but found %s: %s", "an integer", ANSI_CYAN "5" ANSI_NORMAL),
|
hintfmt("expected a Boolean but found %s: %s", "an integer", normaltxt(ANSI_CYAN "5" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the filtering function passed to builtins.filter"));
|
hintfmt("while evaluating the return value of the filtering function passed to builtins.filter"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -698,7 +698,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, elem) {
|
TEST_F(ErrorTraceTest, elem) {
|
||||||
ASSERT_TRACE2("elem 1 \"foo\"",
|
ASSERT_TRACE2("elem 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.elem"));
|
hintfmt("while evaluating the second argument passed to builtins.elem"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -707,17 +707,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, concatLists) {
|
TEST_F(ErrorTraceTest, concatLists) {
|
||||||
ASSERT_TRACE2("concatLists 1",
|
ASSERT_TRACE2("concatLists 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.concatLists"));
|
hintfmt("while evaluating the first argument passed to builtins.concatLists"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatLists [ 1 ]",
|
ASSERT_TRACE2("concatLists [ 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating a value of the list passed to builtins.concatLists"));
|
hintfmt("while evaluating a value of the list passed to builtins.concatLists"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatLists [ [1] \"foo\" ]",
|
ASSERT_TRACE2("concatLists [ [1] \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating a value of the list passed to builtins.concatLists"));
|
hintfmt("while evaluating a value of the list passed to builtins.concatLists"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -726,12 +726,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, length) {
|
TEST_F(ErrorTraceTest, length) {
|
||||||
ASSERT_TRACE2("length 1",
|
ASSERT_TRACE2("length 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.length"));
|
hintfmt("while evaluating the first argument passed to builtins.length"));
|
||||||
|
|
||||||
ASSERT_TRACE2("length \"foo\"",
|
ASSERT_TRACE2("length \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.length"));
|
hintfmt("while evaluating the first argument passed to builtins.length"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -740,21 +740,21 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, foldlPrime) {
|
TEST_F(ErrorTraceTest, foldlPrime) {
|
||||||
ASSERT_TRACE2("foldl' 1 \"foo\" true",
|
ASSERT_TRACE2("foldl' 1 \"foo\" true",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.foldlStrict"));
|
hintfmt("while evaluating the first argument passed to builtins.foldlStrict"));
|
||||||
|
|
||||||
ASSERT_TRACE2("foldl' (_: 1) \"foo\" true",
|
ASSERT_TRACE2("foldl' (_: 1) \"foo\" true",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a Boolean", ANSI_CYAN "true" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a Boolean", normaltxt(ANSI_CYAN "true" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the third argument passed to builtins.foldlStrict"));
|
hintfmt("while evaluating the third argument passed to builtins.foldlStrict"));
|
||||||
|
|
||||||
ASSERT_TRACE1("foldl' (_: 1) \"foo\" [ true ]",
|
ASSERT_TRACE1("foldl' (_: 1) \"foo\" [ true ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("attempt to call something which is not a function but %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL));
|
hintfmt("attempt to call something which is not a function but %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)));
|
||||||
|
|
||||||
ASSERT_TRACE2("foldl' (a: b: a && b) \"foo\" [ true ]",
|
ASSERT_TRACE2("foldl' (a: b: a && b) \"foo\" [ true ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a Boolean but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a Boolean but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("in the left operand of the AND (&&) operator"));
|
hintfmt("in the left operand of the AND (&&) operator"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -763,17 +763,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, any) {
|
TEST_F(ErrorTraceTest, any) {
|
||||||
ASSERT_TRACE2("any 1 \"foo\"",
|
ASSERT_TRACE2("any 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.any"));
|
hintfmt("while evaluating the first argument passed to builtins.any"));
|
||||||
|
|
||||||
ASSERT_TRACE2("any (_: 1) \"foo\"",
|
ASSERT_TRACE2("any (_: 1) \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.any"));
|
hintfmt("while evaluating the second argument passed to builtins.any"));
|
||||||
|
|
||||||
ASSERT_TRACE2("any (_: 1) [ \"foo\" ]",
|
ASSERT_TRACE2("any (_: 1) [ \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a Boolean but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a Boolean but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the function passed to builtins.any"));
|
hintfmt("while evaluating the return value of the function passed to builtins.any"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -782,17 +782,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, all) {
|
TEST_F(ErrorTraceTest, all) {
|
||||||
ASSERT_TRACE2("all 1 \"foo\"",
|
ASSERT_TRACE2("all 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.all"));
|
hintfmt("while evaluating the first argument passed to builtins.all"));
|
||||||
|
|
||||||
ASSERT_TRACE2("all (_: 1) \"foo\"",
|
ASSERT_TRACE2("all (_: 1) \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.all"));
|
hintfmt("while evaluating the second argument passed to builtins.all"));
|
||||||
|
|
||||||
ASSERT_TRACE2("all (_: 1) [ \"foo\" ]",
|
ASSERT_TRACE2("all (_: 1) [ \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a Boolean but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a Boolean but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the function passed to builtins.all"));
|
hintfmt("while evaluating the return value of the function passed to builtins.all"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -801,12 +801,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, genList) {
|
TEST_F(ErrorTraceTest, genList) {
|
||||||
ASSERT_TRACE2("genList 1 \"foo\"",
|
ASSERT_TRACE2("genList 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.genList"));
|
hintfmt("while evaluating the second argument passed to builtins.genList"));
|
||||||
|
|
||||||
ASSERT_TRACE2("genList 1 2",
|
ASSERT_TRACE2("genList 1 2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.genList", "an integer"));
|
hintfmt("while evaluating the first argument passed to builtins.genList", "an integer"));
|
||||||
|
|
||||||
// XXX: defered
|
// XXX: defered
|
||||||
|
@ -825,21 +825,21 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, sort) {
|
TEST_F(ErrorTraceTest, sort) {
|
||||||
ASSERT_TRACE2("sort 1 \"foo\"",
|
ASSERT_TRACE2("sort 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.sort"));
|
hintfmt("while evaluating the second argument passed to builtins.sort"));
|
||||||
|
|
||||||
ASSERT_TRACE2("sort 1 [ \"foo\" ]",
|
ASSERT_TRACE2("sort 1 [ \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.sort"));
|
hintfmt("while evaluating the first argument passed to builtins.sort"));
|
||||||
|
|
||||||
ASSERT_TRACE1("sort (_: 1) [ \"foo\" \"bar\" ]",
|
ASSERT_TRACE1("sort (_: 1) [ \"foo\" \"bar\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("attempt to call something which is not a function but %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL));
|
hintfmt("attempt to call something which is not a function but %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)));
|
||||||
|
|
||||||
ASSERT_TRACE2("sort (_: _: 1) [ \"foo\" \"bar\" ]",
|
ASSERT_TRACE2("sort (_: _: 1) [ \"foo\" \"bar\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a Boolean but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a Boolean but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the sorting function passed to builtins.sort"));
|
hintfmt("while evaluating the return value of the sorting function passed to builtins.sort"));
|
||||||
|
|
||||||
// XXX: Trace too deep, need better asserts
|
// XXX: Trace too deep, need better asserts
|
||||||
|
@ -857,17 +857,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, partition) {
|
TEST_F(ErrorTraceTest, partition) {
|
||||||
ASSERT_TRACE2("partition 1 \"foo\"",
|
ASSERT_TRACE2("partition 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.partition"));
|
hintfmt("while evaluating the first argument passed to builtins.partition"));
|
||||||
|
|
||||||
ASSERT_TRACE2("partition (_: 1) \"foo\"",
|
ASSERT_TRACE2("partition (_: 1) \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.partition"));
|
hintfmt("while evaluating the second argument passed to builtins.partition"));
|
||||||
|
|
||||||
ASSERT_TRACE2("partition (_: 1) [ \"foo\" ]",
|
ASSERT_TRACE2("partition (_: 1) [ \"foo\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a Boolean but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a Boolean but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the partition function passed to builtins.partition"));
|
hintfmt("while evaluating the return value of the partition function passed to builtins.partition"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -876,17 +876,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, groupBy) {
|
TEST_F(ErrorTraceTest, groupBy) {
|
||||||
ASSERT_TRACE2("groupBy 1 \"foo\"",
|
ASSERT_TRACE2("groupBy 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.groupBy"));
|
hintfmt("while evaluating the first argument passed to builtins.groupBy"));
|
||||||
|
|
||||||
ASSERT_TRACE2("groupBy (_: 1) \"foo\"",
|
ASSERT_TRACE2("groupBy (_: 1) \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.groupBy"));
|
hintfmt("while evaluating the second argument passed to builtins.groupBy"));
|
||||||
|
|
||||||
ASSERT_TRACE2("groupBy (x: x) [ \"foo\" \"bar\" 1 ]",
|
ASSERT_TRACE2("groupBy (x: x) [ \"foo\" \"bar\" 1 ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the grouping function passed to builtins.groupBy"));
|
hintfmt("while evaluating the return value of the grouping function passed to builtins.groupBy"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -895,22 +895,22 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, concatMap) {
|
TEST_F(ErrorTraceTest, concatMap) {
|
||||||
ASSERT_TRACE2("concatMap 1 \"foo\"",
|
ASSERT_TRACE2("concatMap 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a function but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a function but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.concatMap"));
|
hintfmt("while evaluating the first argument passed to builtins.concatMap"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatMap (x: 1) \"foo\"",
|
ASSERT_TRACE2("concatMap (x: 1) \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.concatMap"));
|
hintfmt("while evaluating the second argument passed to builtins.concatMap"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatMap (x: 1) [ \"foo\" ] # TODO",
|
ASSERT_TRACE2("concatMap (x: 1) [ \"foo\" ] # TODO",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the function passed to builtins.concatMap"));
|
hintfmt("while evaluating the return value of the function passed to builtins.concatMap"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatMap (x: \"foo\") [ 1 2 ] # TODO",
|
ASSERT_TRACE2("concatMap (x: \"foo\") [ 1 2 ] # TODO",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a list but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the return value of the function passed to builtins.concatMap"));
|
hintfmt("while evaluating the return value of the function passed to builtins.concatMap"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -919,12 +919,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, add) {
|
TEST_F(ErrorTraceTest, add) {
|
||||||
ASSERT_TRACE2("add \"foo\" 1",
|
ASSERT_TRACE2("add \"foo\" 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument of the addition"));
|
hintfmt("while evaluating the first argument of the addition"));
|
||||||
|
|
||||||
ASSERT_TRACE2("add 1 \"foo\"",
|
ASSERT_TRACE2("add 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument of the addition"));
|
hintfmt("while evaluating the second argument of the addition"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -933,12 +933,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, sub) {
|
TEST_F(ErrorTraceTest, sub) {
|
||||||
ASSERT_TRACE2("sub \"foo\" 1",
|
ASSERT_TRACE2("sub \"foo\" 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument of the subtraction"));
|
hintfmt("while evaluating the first argument of the subtraction"));
|
||||||
|
|
||||||
ASSERT_TRACE2("sub 1 \"foo\"",
|
ASSERT_TRACE2("sub 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument of the subtraction"));
|
hintfmt("while evaluating the second argument of the subtraction"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -947,12 +947,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, mul) {
|
TEST_F(ErrorTraceTest, mul) {
|
||||||
ASSERT_TRACE2("mul \"foo\" 1",
|
ASSERT_TRACE2("mul \"foo\" 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument of the multiplication"));
|
hintfmt("while evaluating the first argument of the multiplication"));
|
||||||
|
|
||||||
ASSERT_TRACE2("mul 1 \"foo\"",
|
ASSERT_TRACE2("mul 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument of the multiplication"));
|
hintfmt("while evaluating the second argument of the multiplication"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -961,12 +961,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, div) {
|
TEST_F(ErrorTraceTest, div) {
|
||||||
ASSERT_TRACE2("div \"foo\" 1 # TODO: an integer was expected -> a number",
|
ASSERT_TRACE2("div \"foo\" 1 # TODO: an integer was expected -> a number",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first operand of the division"));
|
hintfmt("while evaluating the first operand of the division"));
|
||||||
|
|
||||||
ASSERT_TRACE2("div 1 \"foo\"",
|
ASSERT_TRACE2("div 1 \"foo\"",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a float but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected a float but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second operand of the division"));
|
hintfmt("while evaluating the second operand of the division"));
|
||||||
|
|
||||||
ASSERT_TRACE1("div \"foo\" 0",
|
ASSERT_TRACE1("div \"foo\" 0",
|
||||||
|
@ -979,12 +979,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, bitAnd) {
|
TEST_F(ErrorTraceTest, bitAnd) {
|
||||||
ASSERT_TRACE2("bitAnd 1.1 2",
|
ASSERT_TRACE2("bitAnd 1.1 2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a float", ANSI_CYAN "1.1" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a float", normaltxt(ANSI_CYAN "1.1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.bitAnd"));
|
hintfmt("while evaluating the first argument passed to builtins.bitAnd"));
|
||||||
|
|
||||||
ASSERT_TRACE2("bitAnd 1 2.2",
|
ASSERT_TRACE2("bitAnd 1 2.2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a float", ANSI_CYAN "2.2" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a float", normaltxt(ANSI_CYAN "2.2" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.bitAnd"));
|
hintfmt("while evaluating the second argument passed to builtins.bitAnd"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -993,12 +993,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, bitOr) {
|
TEST_F(ErrorTraceTest, bitOr) {
|
||||||
ASSERT_TRACE2("bitOr 1.1 2",
|
ASSERT_TRACE2("bitOr 1.1 2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a float", ANSI_CYAN "1.1" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a float", normaltxt(ANSI_CYAN "1.1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.bitOr"));
|
hintfmt("while evaluating the first argument passed to builtins.bitOr"));
|
||||||
|
|
||||||
ASSERT_TRACE2("bitOr 1 2.2",
|
ASSERT_TRACE2("bitOr 1 2.2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a float", ANSI_CYAN "2.2" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a float", normaltxt(ANSI_CYAN "2.2" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.bitOr"));
|
hintfmt("while evaluating the second argument passed to builtins.bitOr"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1007,12 +1007,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, bitXor) {
|
TEST_F(ErrorTraceTest, bitXor) {
|
||||||
ASSERT_TRACE2("bitXor 1.1 2",
|
ASSERT_TRACE2("bitXor 1.1 2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a float", ANSI_CYAN "1.1" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a float", normaltxt(ANSI_CYAN "1.1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.bitXor"));
|
hintfmt("while evaluating the first argument passed to builtins.bitXor"));
|
||||||
|
|
||||||
ASSERT_TRACE2("bitXor 1 2.2",
|
ASSERT_TRACE2("bitXor 1 2.2",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a float", ANSI_CYAN "2.2" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a float", normaltxt(ANSI_CYAN "2.2" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.bitXor"));
|
hintfmt("while evaluating the second argument passed to builtins.bitXor"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1038,7 +1038,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, toString) {
|
TEST_F(ErrorTraceTest, toString) {
|
||||||
ASSERT_TRACE2("toString { a = 1; }",
|
ASSERT_TRACE2("toString { a = 1; }",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a set", "{ a = " ANSI_CYAN "1" ANSI_NORMAL "; }"),
|
hintfmt("cannot coerce %s to a string: %s", "a set", normaltxt("{ a = " ANSI_CYAN "1" ANSI_NORMAL "; }")),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.toString"));
|
hintfmt("while evaluating the first argument passed to builtins.toString"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1047,17 +1047,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, substring) {
|
TEST_F(ErrorTraceTest, substring) {
|
||||||
ASSERT_TRACE2("substring {} \"foo\" true",
|
ASSERT_TRACE2("substring {} \"foo\" true",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a set", "{ }"),
|
hintfmt("expected an integer but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the first argument (the start offset) passed to builtins.substring"));
|
hintfmt("while evaluating the first argument (the start offset) passed to builtins.substring"));
|
||||||
|
|
||||||
ASSERT_TRACE2("substring 3 \"foo\" true",
|
ASSERT_TRACE2("substring 3 \"foo\" true",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected an integer but found %s: %s", "a string", ANSI_MAGENTA "\"foo\"" ANSI_NORMAL),
|
hintfmt("expected an integer but found %s: %s", "a string", normaltxt(ANSI_MAGENTA "\"foo\"" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the second argument (the substring length) passed to builtins.substring"));
|
hintfmt("while evaluating the second argument (the substring length) passed to builtins.substring"));
|
||||||
|
|
||||||
ASSERT_TRACE2("substring 0 3 {}",
|
ASSERT_TRACE2("substring 0 3 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
hintfmt("cannot coerce %s to a string: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the third argument (the string) passed to builtins.substring"));
|
hintfmt("while evaluating the third argument (the string) passed to builtins.substring"));
|
||||||
|
|
||||||
ASSERT_TRACE1("substring (-3) 3 \"sometext\"",
|
ASSERT_TRACE1("substring (-3) 3 \"sometext\"",
|
||||||
|
@ -1070,7 +1070,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, stringLength) {
|
TEST_F(ErrorTraceTest, stringLength) {
|
||||||
ASSERT_TRACE2("stringLength {} # TODO: context is missing ???",
|
ASSERT_TRACE2("stringLength {} # TODO: context is missing ???",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "a set", "{ }"),
|
hintfmt("cannot coerce %s to a string: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the argument passed to builtins.stringLength"));
|
hintfmt("while evaluating the argument passed to builtins.stringLength"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1079,7 +1079,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, hashString) {
|
TEST_F(ErrorTraceTest, hashString) {
|
||||||
ASSERT_TRACE2("hashString 1 {}",
|
ASSERT_TRACE2("hashString 1 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.hashString"));
|
hintfmt("while evaluating the first argument passed to builtins.hashString"));
|
||||||
|
|
||||||
ASSERT_TRACE1("hashString \"foo\" \"content\"",
|
ASSERT_TRACE1("hashString \"foo\" \"content\"",
|
||||||
|
@ -1088,7 +1088,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE2("hashString \"sha256\" {}",
|
ASSERT_TRACE2("hashString \"sha256\" {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a string but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.hashString"));
|
hintfmt("while evaluating the second argument passed to builtins.hashString"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1097,12 +1097,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, match) {
|
TEST_F(ErrorTraceTest, match) {
|
||||||
ASSERT_TRACE2("match 1 {}",
|
ASSERT_TRACE2("match 1 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.match"));
|
hintfmt("while evaluating the first argument passed to builtins.match"));
|
||||||
|
|
||||||
ASSERT_TRACE2("match \"foo\" {}",
|
ASSERT_TRACE2("match \"foo\" {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a string but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.match"));
|
hintfmt("while evaluating the second argument passed to builtins.match"));
|
||||||
|
|
||||||
ASSERT_TRACE1("match \"(.*\" \"\"",
|
ASSERT_TRACE1("match \"(.*\" \"\"",
|
||||||
|
@ -1115,12 +1115,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, split) {
|
TEST_F(ErrorTraceTest, split) {
|
||||||
ASSERT_TRACE2("split 1 {}",
|
ASSERT_TRACE2("split 1 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.split"));
|
hintfmt("while evaluating the first argument passed to builtins.split"));
|
||||||
|
|
||||||
ASSERT_TRACE2("split \"foo\" {}",
|
ASSERT_TRACE2("split \"foo\" {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a string but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.split"));
|
hintfmt("while evaluating the second argument passed to builtins.split"));
|
||||||
|
|
||||||
ASSERT_TRACE1("split \"f(o*o\" \"1foo2\"",
|
ASSERT_TRACE1("split \"f(o*o\" \"1foo2\"",
|
||||||
|
@ -1133,17 +1133,17 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, concatStringsSep) {
|
TEST_F(ErrorTraceTest, concatStringsSep) {
|
||||||
ASSERT_TRACE2("concatStringsSep 1 {}",
|
ASSERT_TRACE2("concatStringsSep 1 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument (the separator string) passed to builtins.concatStringsSep"));
|
hintfmt("while evaluating the first argument (the separator string) passed to builtins.concatStringsSep"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatStringsSep \"foo\" {}",
|
ASSERT_TRACE2("concatStringsSep \"foo\" {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a list but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a list but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the second argument (the list of strings to concat) passed to builtins.concatStringsSep"));
|
hintfmt("while evaluating the second argument (the list of strings to concat) passed to builtins.concatStringsSep"));
|
||||||
|
|
||||||
ASSERT_TRACE2("concatStringsSep \"foo\" [ 1 2 {} ] # TODO: coerce to string is buggy",
|
ASSERT_TRACE2("concatStringsSep \"foo\" [ 1 2 {} ] # TODO: coerce to string is buggy",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("cannot coerce %s to a string: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("cannot coerce %s to a string: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating one element of the list of strings to concat passed to builtins.concatStringsSep"));
|
hintfmt("while evaluating one element of the list of strings to concat passed to builtins.concatStringsSep"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1152,7 +1152,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, parseDrvName) {
|
TEST_F(ErrorTraceTest, parseDrvName) {
|
||||||
ASSERT_TRACE2("parseDrvName 1",
|
ASSERT_TRACE2("parseDrvName 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.parseDrvName"));
|
hintfmt("while evaluating the first argument passed to builtins.parseDrvName"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1161,12 +1161,12 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, compareVersions) {
|
TEST_F(ErrorTraceTest, compareVersions) {
|
||||||
ASSERT_TRACE2("compareVersions 1 {}",
|
ASSERT_TRACE2("compareVersions 1 {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.compareVersions"));
|
hintfmt("while evaluating the first argument passed to builtins.compareVersions"));
|
||||||
|
|
||||||
ASSERT_TRACE2("compareVersions \"abd\" {}",
|
ASSERT_TRACE2("compareVersions \"abd\" {}",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "a set", "{ }"),
|
hintfmt("expected a string but found %s: %s", "a set", normaltxt("{ }")),
|
||||||
hintfmt("while evaluating the second argument passed to builtins.compareVersions"));
|
hintfmt("while evaluating the second argument passed to builtins.compareVersions"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1175,7 @@ namespace nix {
|
||||||
TEST_F(ErrorTraceTest, splitVersion) {
|
TEST_F(ErrorTraceTest, splitVersion) {
|
||||||
ASSERT_TRACE2("splitVersion 1",
|
ASSERT_TRACE2("splitVersion 1",
|
||||||
TypeError,
|
TypeError,
|
||||||
hintfmt("expected a string but found %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL),
|
hintfmt("expected a string but found %s: %s", "an integer", normaltxt(ANSI_CYAN "1" ANSI_NORMAL)),
|
||||||
hintfmt("while evaluating the first argument passed to builtins.splitVersion"));
|
hintfmt("while evaluating the first argument passed to builtins.splitVersion"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue