File: split_spec.lua

package info (click to toggle)
lua-cliargs 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 388 kB
  • sloc: sh: 118; javascript: 14; makefile: 5
file content (24 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (4)
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)