MiSawa / xq

Pure rust implementation of jq
MIT License
333 stars 18 forks source link

fix panic on slice when start is greater than end #38

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

This PR fixes slicing when start is greater than end.

❯ jq -n '[1,2,3] | .[2:1]'
[]

❯ xq -n '[1,2,3] | .[2:1]'
thread 'main' panicked at 'slice index starts at 2 but ends at 1', src/intrinsic/index.rs:177:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
MiSawa commented 2 years ago

Oops, thanks!