diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-06-29 12:16:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 12:16:15 +0200 |
commit | 865af66112b22ff8317f287afa42d2ffe407e3bc (patch) | |
tree | 8e529a2cce8039457114217b07b3c6cab6ea495e | |
parent | 3c1814423b5dede83b16c357414ce6a19e96897c (diff) | |
parent | 455177cbe0aa4c71040857c9b3fa3ccc6312830a (diff) |
Merge pull request #6738 from edolstra/quote
src/libexpr/tests/primops.cc: Quote Nix expressions
-rw-r--r-- | src/libexpr/tests/primops.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/libexpr/tests/primops.cc b/src/libexpr/tests/primops.cc index f65b6593d..16cf66d2c 100644 --- a/src/libexpr/tests/primops.cc +++ b/src/libexpr/tests/primops.cc @@ -540,22 +540,22 @@ namespace nix { 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( toString, ToStringPrimOpTest, testing::Values( - CASE("foo", "foo"), - CASE(1, "1"), - CASE([1 2 3], "1 2 3"), - CASE(.123, "0.123000"), - CASE(true, "1"), - CASE(false, ""), - CASE(null, ""), - CASE({ v = "bar"; __toString = self: self.v; }, "bar"), - CASE({ v = "bar"; __toString = self: self.v; outPath = "foo"; }, "bar"), - CASE({ outPath = "foo"; }, "foo"), - CASE(./test, "/test") + CASE(R"("foo")", "foo"), + CASE(R"(1)", "1"), + CASE(R"([1 2 3])", "1 2 3"), + CASE(R"(.123)", "0.123000"), + CASE(R"(true)", "1"), + CASE(R"(false)", ""), + CASE(R"(null)", ""), + CASE(R"({ v = "bar"; __toString = self: self.v; })", "bar"), + CASE(R"({ v = "bar"; __toString = self: self.v; outPath = "foo"; })", "bar"), + CASE(R"({ outPath = "foo"; })", "foo"), + CASE(R"(./test)", "/test") ) ); #undef CASE |