File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
crates/bashkit/tests/spec_cases/jq Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,33 @@ jq -n --argjson obj '{"a":1}' '$obj.a'
9339331
934934# ## end
935935
936+ # ## jq_arg_field_assignment
937+ # --arg with field assignment using herestring
938+ jq --arg name " John" ' .greeting = "Hello " + $name' <<< ' {}'
939+ # ## expect
940+ {
941+ " greeting" : " Hello John"
942+ }
943+ # ## end
944+
945+ # ## jq_argjson_field_assignment
946+ # --argjson with numeric field assignment
947+ jq --argjson count 42 ' .total = $count' <<< ' {}'
948+ # ## expect
949+ {
950+ " total" : 42
951+ }
952+ # ## end
953+
954+ # ## jq_arg_dynamic_key
955+ # --arg with dynamic key using .[$key]
956+ jq --arg key " name" --arg val " Alice" ' .[$key] = $val' <<< ' {}'
957+ # ## expect
958+ {
959+ " name" : " Alice"
960+ }
961+ # ## end
962+
936963# ## jq_combined_flags_snr
937964# Three combined short flags -snr
938965jq -snr ' "hello"'
You can’t perform that action at this time.
0 commit comments