Drop support for single quotes in interactive mode

This commit is contained in:
Nikolay Yakimov 2015-12-20 07:01:46 +03:00
parent d0c53ec937
commit 06be93bb89
2 changed files with 1 additions and 23 deletions

View File

@ -19,7 +19,7 @@ import Data.Char
import Data.Maybe
isQuote :: Char -> Bool
isQuote = (`elem` "\"'")
isQuote = (==) '"'
isEscapeChar :: Char -> Bool
isEscapeChar = (==) '\\'

View File

@ -13,20 +13,9 @@ spec =
it "honors double quotes" $
parseCmdLine "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
parseCmdLine "with\\ spaces"
`shouldBe` ["with spaces"]
parseCmdLine "'with\\ spaces'"
`shouldBe` ["with spaces"]
parseCmdLine "\"with\\ spaces\""
`shouldBe` ["with spaces"]
it "escapes '\\'" $ do
@ -34,20 +23,9 @@ spec =
`shouldBe` ["\\"]
parseCmdLine "\"\\\\\""
`shouldBe` ["\\"]
parseCmdLine "'\\\\'"
`shouldBe` ["\\"]
it "escapes single quotes" $ do
parseCmdLine "\\'"
`shouldBe` ["'"]
parseCmdLine "'\\''"
`shouldBe` ["'"]
parseCmdLine "\"\\'\""
`shouldBe` ["'"]
it "escapes double quotes" $ do
parseCmdLine "\\\""
`shouldBe` ["\""]
parseCmdLine "'\\\"'"
`shouldBe` ["\""]
parseCmdLine "\"\\\"\""
`shouldBe` ["\""]
it "doesn't escape random characters" $