Drop support for single quotes in interactive mode
This commit is contained in:
parent
d0c53ec937
commit
06be93bb89
@ -19,7 +19,7 @@ import Data.Char
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
||||||
isQuote :: Char -> Bool
|
isQuote :: Char -> Bool
|
||||||
isQuote = (`elem` "\"'")
|
isQuote = (==) '"'
|
||||||
|
|
||||||
isEscapeChar :: Char -> Bool
|
isEscapeChar :: Char -> Bool
|
||||||
isEscapeChar = (==) '\\'
|
isEscapeChar = (==) '\\'
|
||||||
|
@ -13,20 +13,9 @@ spec =
|
|||||||
it "honors double quotes" $
|
it "honors double quotes" $
|
||||||
parseCmdLine "test command line \"with double quotes\""
|
parseCmdLine "test command line \"with double quotes\""
|
||||||
`shouldBe` ["test", "command", "line", "with double quotes"]
|
`shouldBe` ["test", "command", "line", "with double quotes"]
|
||||||
it "honors single quotes" $
|
|
||||||
parseCmdLine "test command line 'with single quotes'"
|
|
||||||
`shouldBe` ["test", "command", "line", "with single quotes"]
|
|
||||||
it "understands single quote in double quotes" $
|
|
||||||
parseCmdLine "test for \"quoted argument with ' single quote\" here"
|
|
||||||
`shouldBe` ["test", "for", "quoted argument with ' single quote", "here"]
|
|
||||||
it "understands double quote in single quotes" $
|
|
||||||
parseCmdLine "test for \'quoted argument with \" double quote\' here"
|
|
||||||
`shouldBe` ["test", "for", "quoted argument with \" double quote", "here"]
|
|
||||||
it "escapes spaces" $ do
|
it "escapes spaces" $ do
|
||||||
parseCmdLine "with\\ spaces"
|
parseCmdLine "with\\ spaces"
|
||||||
`shouldBe` ["with spaces"]
|
`shouldBe` ["with spaces"]
|
||||||
parseCmdLine "'with\\ spaces'"
|
|
||||||
`shouldBe` ["with spaces"]
|
|
||||||
parseCmdLine "\"with\\ spaces\""
|
parseCmdLine "\"with\\ spaces\""
|
||||||
`shouldBe` ["with spaces"]
|
`shouldBe` ["with spaces"]
|
||||||
it "escapes '\\'" $ do
|
it "escapes '\\'" $ do
|
||||||
@ -34,20 +23,9 @@ spec =
|
|||||||
`shouldBe` ["\\"]
|
`shouldBe` ["\\"]
|
||||||
parseCmdLine "\"\\\\\""
|
parseCmdLine "\"\\\\\""
|
||||||
`shouldBe` ["\\"]
|
`shouldBe` ["\\"]
|
||||||
parseCmdLine "'\\\\'"
|
|
||||||
`shouldBe` ["\\"]
|
|
||||||
it "escapes single quotes" $ do
|
|
||||||
parseCmdLine "\\'"
|
|
||||||
`shouldBe` ["'"]
|
|
||||||
parseCmdLine "'\\''"
|
|
||||||
`shouldBe` ["'"]
|
|
||||||
parseCmdLine "\"\\'\""
|
|
||||||
`shouldBe` ["'"]
|
|
||||||
it "escapes double quotes" $ do
|
it "escapes double quotes" $ do
|
||||||
parseCmdLine "\\\""
|
parseCmdLine "\\\""
|
||||||
`shouldBe` ["\""]
|
`shouldBe` ["\""]
|
||||||
parseCmdLine "'\\\"'"
|
|
||||||
`shouldBe` ["\""]
|
|
||||||
parseCmdLine "\"\\\"\""
|
parseCmdLine "\"\\\"\""
|
||||||
`shouldBe` ["\""]
|
`shouldBe` ["\""]
|
||||||
it "doesn't escape random characters" $
|
it "doesn't escape random characters" $
|
||||||
|
Loading…
Reference in New Issue
Block a user