Skip to content

Commit

Permalink
add tests for immutability of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Apr 15, 2024
1 parent 3a675cc commit 8d7ccc9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions cli/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,14 @@
"x": 0
}
- name: add function with slicing
args:
- -c
- '[.[:2], [0], .[1:]] | add'
input: '[1,2,3]'
expected: |
[1,2,0,2,3]
- name: add function error
args:
- 'add'
Expand Down Expand Up @@ -2857,16 +2865,26 @@
[1,2]
[]
- name: ensure arrays are immutable during addition
- name: arrays are immutable on addition
args:
- -c
- '. as $first | .[:0] + [6, 7, 8] | ., $first'
- '. as $v | .[:0] + [6, 7, 8] | ., $v'
input: |
[1,2,3,4,5]
expected: |
[6,7,8]
[1,2,3,4,5]
- name: arrays are immutable on subtraction
args:
- -c
- '. as $v | . - [2, 3] | ., $v'
input: |
[1,2,3,4,5]
expected: |
[1,4,5]
[1,2,3,4,5]
- name: subtract arrays
args:
- -c
Expand Down

0 comments on commit 8d7ccc9

Please sign in to comment.