aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-06-30 01:29:11 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-07-31 13:02:54 +0200
commit33d58a90c26f9a62bb20863b767c0a505e6f997a (patch)
treea78863601e7febc70c69d505b1c6f4847701d116 /tests
parent2d1d81114d72ace89ce08cd3bc93f4eb27a2975d (diff)
toJSON: Add attribute path to trace
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/eval-fail-toJSON.err.exp57
-rw-r--r--tests/lang/eval-fail-toJSON.nix10
2 files changed, 67 insertions, 0 deletions
diff --git a/tests/lang/eval-fail-toJSON.err.exp b/tests/lang/eval-fail-toJSON.err.exp
new file mode 100644
index 000000000..4e618c203
--- /dev/null
+++ b/tests/lang/eval-fail-toJSON.err.exp
@@ -0,0 +1,57 @@
+error:
+ … while calling the 'toJSON' builtin
+
+ at /pwd/lang/eval-fail-toJSON.nix:1:1:
+
+ 1| builtins.toJSON {
+ | ^
+ 2| a.b = [
+
+ … while evaluating attribute 'a'
+
+ at /pwd/lang/eval-fail-toJSON.nix:2:3:
+
+ 1| builtins.toJSON {
+ 2| a.b = [
+ | ^
+ 3| true
+
+ … while evaluating attribute 'b'
+
+ at /pwd/lang/eval-fail-toJSON.nix:2:3:
+
+ 1| builtins.toJSON {
+ 2| a.b = [
+ | ^
+ 3| true
+
+ … while evaluating list element at index 3
+
+ … while evaluating attribute 'c'
+
+ at /pwd/lang/eval-fail-toJSON.nix:7:7:
+
+ 6| {
+ 7| c.d = throw "hah no";
+ | ^
+ 8| }
+
+ … while evaluating attribute 'd'
+
+ at /pwd/lang/eval-fail-toJSON.nix:7:7:
+
+ 6| {
+ 7| c.d = throw "hah no";
+ | ^
+ 8| }
+
+ … while calling the 'throw' builtin
+
+ at /pwd/lang/eval-fail-toJSON.nix:7:13:
+
+ 6| {
+ 7| c.d = throw "hah no";
+ | ^
+ 8| }
+
+ error: hah no
diff --git a/tests/lang/eval-fail-toJSON.nix b/tests/lang/eval-fail-toJSON.nix
new file mode 100644
index 000000000..8112e1c1f
--- /dev/null
+++ b/tests/lang/eval-fail-toJSON.nix
@@ -0,0 +1,10 @@
+builtins.toJSON {
+ a.b = [
+ true
+ false
+ "it's a bird"
+ {
+ c.d = throw "hah no";
+ }
+ ];
+}