From ab1fe80150a8031fb702b9ff776db2db4dea89a4 Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Tue, 10 Jan 2023 09:25:48 -0500 Subject: Error when string.split is given empty separator (#13132) --- builtin/common/tests/misc_helpers_spec.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'builtin/common/tests') diff --git a/builtin/common/tests/misc_helpers_spec.lua b/builtin/common/tests/misc_helpers_spec.lua index ff0f0298a..73a66737f 100644 --- a/builtin/common/tests/misc_helpers_spec.lua +++ b/builtin/common/tests/misc_helpers_spec.lua @@ -38,6 +38,12 @@ describe("string", function() assert.same({ "one", "two" }, string.split("one,two", ",", false, -1, true)) assert.same({ "one", "two", "three" }, string.split("one2two3three", "%d", false, -1, true)) end) + + it("rejects empty separator", function() + assert.has.errors(function() + string.split("", "") + end) + end) end) end) -- cgit v1.2.3