mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-21 06:53:00 +00:00
split_shell: added some more test cases for unclosed quotes
This commit is contained in:
parent
7bdefc8d42
commit
66c257c146
1 changed files with 27 additions and 1 deletions
|
@ -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)
|
Loading…
Reference in a new issue