diff --git a/spec/gears/string_spec.lua b/spec/gears/string_spec.lua index a696cbb2..9feeb60e 100644 --- a/spec/gears/string_spec.lua +++ b/spec/gears/string_spec.lua @@ -34,12 +34,14 @@ describe("gears.string", function() assert.is_true(gstring.startswith("something", "")) assert.is_true(gstring.startswith("something", "some")) assert.is_false(gstring.startswith("something", "none")) + assert.is_false(gstring.startswith(nil, "anything")) end) describe("endswith", function() assert.is_true(gstring.endswith("something", "")) assert.is_true(gstring.endswith("something", "thing")) assert.is_false(gstring.endswith("something", "that")) + assert.is_false(gstring.endswith(nil, "anything")) end) describe("split", function() diff --git a/tests/examples/text/gears/string/endswith.lua b/tests/examples/text/gears/string/endswith.lua index 7cddc51e..742a9988 100644 --- a/tests/examples/text/gears/string/endswith.lua +++ b/tests/examples/text/gears/string/endswith.lua @@ -10,3 +10,6 @@ res = gears.string.endswith(test,"do") print(tostring(res)) assert(res == false) --DOC_HIDE +res = gears.string.endswith(nil,"it") +print(tostring(res)) +assert(res == false) --DOC_HIDE diff --git a/tests/examples/text/gears/string/endswith.output.txt b/tests/examples/text/gears/string/endswith.output.txt index da29283a..36bc6136 100644 --- a/tests/examples/text/gears/string/endswith.output.txt +++ b/tests/examples/text/gears/string/endswith.output.txt @@ -1,2 +1,3 @@ true false +false diff --git a/tests/examples/text/gears/string/startswith.lua b/tests/examples/text/gears/string/startswith.lua index f6254389..a0a45985 100644 --- a/tests/examples/text/gears/string/startswith.lua +++ b/tests/examples/text/gears/string/startswith.lua @@ -9,3 +9,7 @@ assert(res == true) --DOC_HIDE res = gears.string.startswith(test,"it") print(tostring(res)) -- print boolean value assert(res == false) --DOC_HIDE + +res = gears.string.startswith(nil,"do") +print(tostring(res)) -- print boolean value +assert(res == false) --DOC_HIDE diff --git a/tests/examples/text/gears/string/startswith.output.txt b/tests/examples/text/gears/string/startswith.output.txt index da29283a..36bc6136 100644 --- a/tests/examples/text/gears/string/startswith.output.txt +++ b/tests/examples/text/gears/string/startswith.output.txt @@ -1,2 +1,3 @@ true false +false