tests/functional2/lang: Migrate builtins.toJSON
Change-Id: Ic740ab1fe0792c7e7596ae8a9beb9e76b37d6284
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
error:
|
||||
… while calling the 'toJSON' builtin
|
||||
at /pwd/in.nix:1:1:
|
||||
1| builtins.toJSON { foo = a: 1; }
|
||||
| ^
|
||||
2|
|
||||
|
||||
… while evaluating attribute 'foo'
|
||||
at /pwd/in.nix:1:19:
|
||||
1| builtins.toJSON { foo = a: 1; }
|
||||
| ^
|
||||
2|
|
||||
|
||||
error: cannot convert a function to JSON
|
||||
at /pwd/in.nix:1:19:
|
||||
1| builtins.toJSON { foo = a: 1; }
|
||||
| ^
|
||||
2|
|
||||
@@ -0,0 +1,50 @@
|
||||
error:
|
||||
… while calling the 'toJSON' builtin
|
||||
at /pwd/in.nix:1:1:
|
||||
1| builtins.toJSON {
|
||||
| ^
|
||||
2| a.b = [
|
||||
|
||||
… while evaluating attribute 'a'
|
||||
at /pwd/in.nix:2:3:
|
||||
1| builtins.toJSON {
|
||||
2| a.b = [
|
||||
| ^
|
||||
3| true
|
||||
|
||||
… while evaluating attribute 'b'
|
||||
at /pwd/in.nix:2:3:
|
||||
1| builtins.toJSON {
|
||||
2| a.b = [
|
||||
| ^
|
||||
3| true
|
||||
|
||||
… while evaluating list element at index 3
|
||||
at /pwd/in.nix:2:3:
|
||||
1| builtins.toJSON {
|
||||
2| a.b = [
|
||||
| ^
|
||||
3| true
|
||||
|
||||
… while evaluating attribute 'c'
|
||||
at /pwd/in.nix:7:7:
|
||||
6| {
|
||||
7| c.d = throw "hah no";
|
||||
| ^
|
||||
8| }
|
||||
|
||||
… while evaluating attribute 'd'
|
||||
at /pwd/in.nix:7:7:
|
||||
6| {
|
||||
7| c.d = throw "hah no";
|
||||
| ^
|
||||
8| }
|
||||
|
||||
… caused by explicit throw
|
||||
at /pwd/in.nix:7:13:
|
||||
6| {
|
||||
7| c.d = throw "hah no";
|
||||
| ^
|
||||
8| }
|
||||
|
||||
error: hah no
|
||||
@@ -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,\"j\":1.44,\"k\":\"foo\"}"
|
||||
@@ -0,0 +1 @@
|
||||
builtins.toJSON { foo = a: 1; }
|
||||
@@ -0,0 +1,10 @@
|
||||
builtins.toJSON {
|
||||
a.b = [
|
||||
true
|
||||
false
|
||||
"it's a bird"
|
||||
{
|
||||
c.d = throw "hah no";
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
j = 1.44;
|
||||
k = { __toString = self: self.a; a = "foo"; };
|
||||
}
|
||||
Reference in New Issue
Block a user