diff --git a/.tests/strings/split_shell.test.lua b/.tests/strings/split_shell.test.lua index 94ed670..f876cf5 100644 --- a/.tests/strings/split_shell.test.lua +++ b/.tests/strings/split_shell.test.lua @@ -141,7 +141,6 @@ describe("split_shell", function() split_shell("\\\"cake\" \"cake\"") ) end) - it("should handle redundant double and single quotes again", function() assert.are.same( { "cake", "cake", "cake", "is", "a", "li\\e" }, @@ -149,4 +148,31 @@ describe("split_shell", function() ) end) + -- Unclosed quotes are currently considered to last until the end of the string. + + it("should handle an unclosed double quote", function() + assert.are.same( + { "the", "cake is a lie" }, + split_shell("the \"cake is a lie") + ) + end) + it("should handle an unclosed single quote", function() + assert.are.same( + { "the", "cake is a lie" }, + split_shell("the 'cake is a lie") + ) + end) + it("should handle an unclosed single quote at the end", function() + assert.are.same( + { "the", "cake is a lie'" }, + split_shell("the \"cake is a lie'") + ) + end) + it("should handle an unclosed single and double quote", function() + assert.are.same( + { "the", "cake is \"a lie" }, + split_shell("the 'cake is \"a lie") + ) + end) + end) \ No newline at end of file