From d3fa5b8a0c750fa9a2b62d54207430f4465774f7 Mon Sep 17 00:00:00 2001 From: myaaaaaaaaa <103326468+myaaaaaaaaa@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:52:54 -0400 Subject: [PATCH] Better test for add(empty) --- tests/jq.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/jq.test b/tests/jq.test index 8566ac885e..d249bc1936 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -646,6 +646,11 @@ map_values(.+1) null [null,120,null,55] +# Real-world use case for add(empty) +.sum = add(.arr[]) +{"arr":[]} +{"arr":[],"sum":null} + add({(.[]):1}) | keys ["a","a","b","a","d","b","d","a","d"] ["a","b","d"]