Merge pull request #6738 from edolstra/quote
src/libexpr/tests/primops.cc: Quote Nix expressions
This commit is contained in:
commit
865af66112
1 changed files with 12 additions and 12 deletions
|
@ -540,22 +540,22 @@ namespace nix {
|
||||||
ASSERT_THAT(v, IsStringEq(output));
|
ASSERT_THAT(v, IsStringEq(output));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CASE(input, output) (std::make_tuple(std::string_view("builtins.toString " #input), std::string_view(output)))
|
#define CASE(input, output) (std::make_tuple(std::string_view("builtins.toString " input), std::string_view(output)))
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
toString,
|
toString,
|
||||||
ToStringPrimOpTest,
|
ToStringPrimOpTest,
|
||||||
testing::Values(
|
testing::Values(
|
||||||
CASE("foo", "foo"),
|
CASE(R"("foo")", "foo"),
|
||||||
CASE(1, "1"),
|
CASE(R"(1)", "1"),
|
||||||
CASE([1 2 3], "1 2 3"),
|
CASE(R"([1 2 3])", "1 2 3"),
|
||||||
CASE(.123, "0.123000"),
|
CASE(R"(.123)", "0.123000"),
|
||||||
CASE(true, "1"),
|
CASE(R"(true)", "1"),
|
||||||
CASE(false, ""),
|
CASE(R"(false)", ""),
|
||||||
CASE(null, ""),
|
CASE(R"(null)", ""),
|
||||||
CASE({ v = "bar"; __toString = self: self.v; }, "bar"),
|
CASE(R"({ v = "bar"; __toString = self: self.v; })", "bar"),
|
||||||
CASE({ v = "bar"; __toString = self: self.v; outPath = "foo"; }, "bar"),
|
CASE(R"({ v = "bar"; __toString = self: self.v; outPath = "foo"; })", "bar"),
|
||||||
CASE({ outPath = "foo"; }, "foo"),
|
CASE(R"({ outPath = "foo"; })", "foo"),
|
||||||
CASE(./test, "/test")
|
CASE(R"(./test)", "/test")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
#undef CASE
|
#undef CASE
|
||||||
|
|
Loading…
Reference in a new issue