about summary refs log tree commit diff
path: root/tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix')
-rw-r--r--tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix b/tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix
index 918061b8b861..41e7f207b9e8 100644
--- a/tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix
+++ b/tvix/glue/src/tests/tvix_tests/eval-okay-context-propagation.nix
@@ -93,4 +93,27 @@ in
   (preserveContext other-drv (builtins.concatStringsSep "${other-drv}" [ "abc" "def" ]))
   # `attrNames` will never ever produce context.
   (preserveContext "abc" (toString (builtins.attrNames { a = { }; b = { }; c = { }; })))
+  # `toJSON` preserves context of its inputs.
+  (preserveContexts [ drv other-drv ] (builtins.toJSON {
+    a = [ drv ];
+    b = [ other-drv ];
+  }))
+  (preserveContexts [ drv other-drv ] (builtins.toJSON {
+    a.deep = [ drv ];
+    b = [ other-drv ];
+  }))
+  (preserveContexts [ drv other-drv ] (builtins.toJSON {
+    a = "${drv}";
+    b = [ other-drv ];
+  }))
+  (preserveContexts [ drv other-drv ] (builtins.toJSON {
+    a.deep = "${drv}";
+    b = [ other-drv ];
+  }))
+  (preserveContexts [ drv other-drv ] (builtins.toJSON {
+    a = "${drv} ${other-drv}";
+  }))
+  (preserveContexts [ drv other-drv ] (builtins.toJSON {
+    a.b.c.d.e.f = "${drv} ${other-drv}";
+  }))
 ]