From 06be93bb89cd3b9a6adaf78047f657f84c617bac Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 20 Dec 2015 07:01:46 +0300 Subject: [PATCH] Drop support for single quotes in interactive mode --- src/GHCMod/Options/ShellEscape.hs | 2 +- test/ShellEscapeSpec.hs | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/GHCMod/Options/ShellEscape.hs b/src/GHCMod/Options/ShellEscape.hs index 4671c73..6cfe1ce 100644 --- a/src/GHCMod/Options/ShellEscape.hs +++ b/src/GHCMod/Options/ShellEscape.hs @@ -19,7 +19,7 @@ import Data.Char import Data.Maybe isQuote :: Char -> Bool -isQuote = (`elem` "\"'") +isQuote = (==) '"' isEscapeChar :: Char -> Bool isEscapeChar = (==) '\\' diff --git a/test/ShellEscapeSpec.hs b/test/ShellEscapeSpec.hs index bcdceda..4b0d997 100644 --- a/test/ShellEscapeSpec.hs +++ b/test/ShellEscapeSpec.hs @@ -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" $