From e7bf8de081948fb1a3e8bd6087bce3795b4c5752 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 21 Aug 2017 09:05:37 +0200 Subject: [PATCH] Add tests for gears.string.startswith and endswith Signed-off-by: Uli Schlachter --- spec/gears/string_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/gears/string_spec.lua b/spec/gears/string_spec.lua index 817bdbed9..11f7e6e33 100644 --- a/spec/gears/string_spec.lua +++ b/spec/gears/string_spec.lua @@ -29,4 +29,18 @@ describe("gears.string", function() assert.is.equal(string.match("DownLow", gstring.query_to_pattern("ownl")), "ownL") end) end) + + describe("startswith", function() + assert.is_true(gstring.startswith("something", "")) + assert.is_true(gstring.startswith("something", "some")) + assert.is_false(gstring.startswith("something", "none")) + end) + + describe("endswith", function() + assert.is_true(gstring.endswith("something", "")) + assert.is_true(gstring.endswith("something", "thing")) + assert.is_false(gstring.endswith("something", "that")) + end) end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80