extend("test")
extend("array")
describe("array:slice", () => {
it("slices an int array", () => {
expect_equal(array:slice(1, 3, [10,20,30,40]), [20,30])
})
it("supports negative indices", () => {
expect_equal(array:slice(-3, -1, [1,2,3,4,5]), [3,4])
})
it("works on MixedArray", () => {
expect_equal(array:slice(0, 2, ["a", 1, "b"]), ["a", 1])
})
it("supports partial usage", () => {
s = array:slice(1, 4)
expect_equal(s([0,1,2,3,4]), [1,2,3])
})
})