about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-tojson-tostring.nix
blob: ec6f8d947cecd254c5f8abbf344a590933f1da55 (plain) (blame)
1
2
3
4
5
6
7
8
# Attribute sets with a `__toString` attribute JSON-serialise with a
# string coercion of the function call result.

builtins.toJSON {
  __toString = self: "it's " + (builtins.toString (self.x * self.y));
  x = 21;
  y = 2;
}