From 77c13cdf566ffedc70d8860571afae8a6d43b552 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 19 Nov 2013 00:03:11 +0100 Subject: Add a toJSON primop --- tests/lang/eval-okay-tojson.exp | 1 + tests/lang/eval-okay-tojson.nix | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/lang/eval-okay-tojson.exp create mode 100644 tests/lang/eval-okay-tojson.nix (limited to 'tests') diff --git a/tests/lang/eval-okay-tojson.exp b/tests/lang/eval-okay-tojson.exp new file mode 100644 index 000000000000..e8164af2b66e --- /dev/null +++ b/tests/lang/eval-okay-tojson.exp @@ -0,0 +1 @@ +"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3}" diff --git a/tests/lang/eval-okay-tojson.nix b/tests/lang/eval-okay-tojson.nix new file mode 100644 index 000000000000..0d4e55b3d367 --- /dev/null +++ b/tests/lang/eval-okay-tojson.nix @@ -0,0 +1,11 @@ +builtins.toJSON + { a = 123; + b = -456; + c = "foo"; + d = "foo\n\"bar\""; + e = true; + f = false; + g = [ 1 2 3 ]; + h = [ "a" [ "b" { "foo\nbar" = {}; } ] ]; + i = 1 + 2; + } -- cgit 1.4.1