about summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2022-05-23 17:55:18 +0200
committerGitHub <noreply@github.com>2022-05-23 17:55:18 +0200
commit4b2827e6a180274a4df35f0754cc6353ca853998 (patch)
treeb843ad8b68b2f863142b4860ecafd7b94d3710e6 /lib/tests
parentc70995bae3ffc31956104595ee48eaafb8525f44 (diff)
parent72037880688ff9c6f4188a5746c3ab5ce7215628 (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.nix15
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 ] ];