Check some more cases, especially empty strings

develop
lethosor 2021-06-24 00:42:50 -04:00
parent 1da0f85192
commit 0297a5b1b8
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 9 additions and 0 deletions

@ -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