1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
local subject = require('cliargs.utils.split')
describe("utils::split", function()
it("should work", function()
-- takes: str, split-char
local expected, result
result = subject("hello,world",",")
expected = {"hello", "world"}
assert.is.same(result, expected)
result = subject("hello,world,",",")
expected = {"hello", "world"}
assert.is.same(result, expected)
result = subject("hello",",")
expected = {"hello"}
assert.is.same(result, expected)
result = subject("",",")
expected = {}
assert.is.same(result, expected)
end)
end)
|