mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-27 01:23:45 +01:00
split_shell: added some more test cases for unclosed quotes
This commit is contained in:
parent
7bdefc8d42
commit
66c257c146
@ -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 New Issue
Block a user