extend("test")
extend("array")
describe("array:join", () => {
it("joins a string array with a separator", () => {
expect_equal(array:join("-", ["a","b","c"]), "a-b-c")
})
it("returns empty string for empty arrays", () => {
expect_equal(array:join(",", []), "")
})
it("accepts MixedArray of strings", () => {
expect_equal(array:join(":", ["a","b"]), "a:b")
expect_equal(array:join(":", ["x"]), "x")
})
it("passes through single string input unchanged", () => {
expect_equal(array:join(",", "hello"), "hello")
})
it("supports partial usage with separator first", () => {
j = array:join("/")
expect_equal(j(["p","q"]), "p/q")
})
it("supports placeholder for separator with array known", () => {
p = array:join(_, ["A","B"])
expect_equal(p("-"), "A-B")
})
})