From a732301306c69e81b213663f21aeafc5302b6b58 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 3 Jan 2019 18:33:06 +0100 Subject: [PATCH] tests: add basic tests for gears.string.split --- spec/gears/string_spec.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/gears/string_spec.lua b/spec/gears/string_spec.lua index 11f7e6e3..58f0396e 100644 --- a/spec/gears/string_spec.lua +++ b/spec/gears/string_spec.lua @@ -41,6 +41,14 @@ describe("gears.string", function() assert.is_true(gstring.endswith("something", "thing")) assert.is_false(gstring.endswith("something", "that")) end) + + describe("split", function() + assert.is_same(gstring.split("", "\n"), {""}) + assert.is_same(gstring.split("\n", "\n"), {"", ""}) + assert.is_same(gstring.split("foo", "\n"), {"foo"}) + assert.is_same(gstring.split("foo\n", "\n"), {"foo", ""}) + assert.is_same(gstring.split("foo\nbar", "\n"), {"foo", "bar"}) + end) end) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80