From 0297a5b1b8ea5492c99cbd214b37dcfd97f16bbe Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 24 Jun 2021 00:42:50 -0400 Subject: [PATCH] Check some more cases, especially empty strings --- test/library/string.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/library/string.lua b/test/library/string.lua index fdb278d40..58bd2d6e4 100644 --- a/test/library/string.lua +++ b/test/library/string.lua @@ -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