diff options
author | Silvan Mosberger <contact@infinisil.com> | 2022-05-23 17:55:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 17:55:18 +0200 |
commit | 4b2827e6a180274a4df35f0754cc6353ca853998 (patch) | |
tree | b843ad8b68b2f863142b4860ecafd7b94d3710e6 /lib/tests | |
parent | c70995bae3ffc31956104595ee48eaafb8525f44 (diff) | |
parent | 72037880688ff9c6f4188a5746c3ab5ce7215628 (diff) |
Merge pull request #168374 from Ma27/special-attrs-in-with-recursion
lib/generators: withRecursion: don't break attr-sets with special attrs
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/misc.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 1154edf1de628..584a946e92cc1 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -674,6 +674,21 @@ runTests { expected = false; }; + testWithRecursionDealsWithFunctors = + let + functor = { + __functor = self: { a, b, }: null; + }; + a = { + value = "1234"; + b = functor; + c.d = functor; + }; + in { + expr = generators.toPretty { } (generators.withRecursion { depthLimit = 1; throwOnDepthLimit = false; } a); + expected = "{\n b = <function, args: {a, b}>;\n c = {\n d = \"<unevaluated>\";\n };\n value = \"<unevaluated>\";\n}"; + }; + testToPrettyMultiline = { expr = mapAttrs (const (generators.toPretty { })) rec { list = [ 3 4 [ false ] ]; |