snix/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-tojson-thunks.nix
Vincent Ambo 02d35e4aa6 feat(tvix/eval): implement builtins.toJSON
Implements `Serialize` for `tvix_eval::Value`. Special care is taken
with serialisation of attribute sets, and forcing of thunks.

The tests should cover both cases well.

Change-Id: I9bb135bacf6f87bc6bd0bd88cef0a42308e6c335
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7803
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
2023-01-12 10:42:44 +00:00

9 lines
94 B
Nix

let
a = b * 2;
b = 21;
in
builtins.toJSON [
a
((n: n * 2) 21)
(builtins.toJSON a)
]