You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
official C++ Jsonnet's observed CLI behavior treats negative integer limits as unlimited;
go-jsonnet and jrsonnet reject values below -1;
sjsonnet currently matches go/jrsonnet for -2, but matches official for fractional values that truncate to 0 or 1.
Direction
For strict official CLI compatibility, sjsonnet should treat negative integer maxsplits values as unlimited, not only -1, while preserving the current fractional truncation behavior that already matches official for -0.5, 0.5, and 1.5.
Add direction tests for both splitLimit and splitLimitR.
Summary
During the stdlib 1:1 audit,
std.splitLimit/std.splitLimitRwere found to differ for negativemaxsplitsvalues other than-1.Official C++ Jsonnet
v0.22.0treats negative integermaxsplitsas unlimited splitting. sjsonnet currently rejects values below-1.Evidence
Environment:
Jsonnet commandline interpreter v0.22.0Jsonnet commandline interpreter (Go implementation) v0.22.0jrsonnet 0.5.0-pre98, commit80cd36abd868507312e2cc2c78cb0f55a684c620std.splitLimit("a,b,c", ",", -1)["a","b","c"]["a","b","c"]["a","b","c"]["a","b","c"]std.splitLimit("a,b,c", ",", -2)["a","b","c"]std.splitLimit("a,b,c", ",", -0.5)["a,b,c"]["a,b,c"]std.splitLimit("a,b,c", ",", 0.5)["a,b,c"]["a,b,c"]std.splitLimit("a,b,c", ",", 1.5)["a","b,c"]["a","b,c"]std.splitLimitR("a,b,c", ",", -2)["a","b","c"]Notes
This edge is subtle:
-1;-2, but matches official for fractional values that truncate to0or1.Direction
For strict official CLI compatibility, sjsonnet should treat negative integer
maxsplitsvalues as unlimited, not only-1, while preserving the current fractional truncation behavior that already matches official for-0.5,0.5, and1.5.Add direction tests for both
splitLimitandsplitLimitR.