|
|
|
@ -4,12 +4,20 @@ function test.startswith()
|
|
|
|
|
expect.true_(('abcd'):startswith(''))
|
|
|
|
|
expect.true_(('abcd'):startswith('abc'))
|
|
|
|
|
expect.false_(('abcd'):startswith('bcd'))
|
|
|
|
|
expect.false_(('abcd'):startswith('abcde'))
|
|
|
|
|
|
|
|
|
|
expect.true_((''):startswith(''))
|
|
|
|
|
expect.false_((''):startswith('a'))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test.endswith()
|
|
|
|
|
expect.true_(('abcd'):endswith(''))
|
|
|
|
|
expect.true_(('abcd'):endswith('bcd'))
|
|
|
|
|
expect.false_(('abcd'):endswith('abc'))
|
|
|
|
|
expect.false_(('abcd'):endswith('zabcd'))
|
|
|
|
|
|
|
|
|
|
expect.true_((''):endswith(''))
|
|
|
|
|
expect.false_((''):endswith('a'))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test.wrap()
|
|
|
|
@ -21,4 +29,5 @@ function test.wrap()
|
|
|
|
|
expect.eq('hello\nworld', ('hello world'):wrap(8))
|
|
|
|
|
expect.eq('hel\nlo\nwor\nld', ('hello world'):wrap(3))
|
|
|
|
|
expect.eq('hel\nloo\nwor\nldo', ('helloo worldo'):wrap(3))
|
|
|
|
|
expect.eq('', (''):wrap(10))
|
|
|
|
|
end
|
|
|
|
|