packages feed

here 1.2.13 → 1.2.14

raw patch · 4 files changed

+89/−3 lines, 4 filesdep +bytestringdep +heredep +hspecdep ~mtl

Dependencies added: bytestring, here, hspec, text

Dependency ranges changed: mtl

Files

here.cabal view
@@ -1,5 +1,5 @@ name: here-version: 1.2.13+version: 1.2.14 synopsis: Here docs & interpolated strings via quasiquotation description: Here docs & interpolated strings via quasiquotation license: BSD3@@ -10,7 +10,7 @@ homepage: https://github.com/tmhedberg/here category: Data build-type: Simple-cabal-version: >=1.8+cabal-version: >=1.10  source-repository head   type: git@@ -27,7 +27,23 @@   build-depends:     base >= 4.5 && < 5,     haskell-src-meta >= 0.6 && < 0.9,-    mtl >=2.1 && < 2.3,+    mtl >=2.1 && < 2.4,     parsec ==3.1.*,     template-haskell   ghc-options: -Wall+  default-language: Haskell2010++test-suite here-test+  type: exitcode-stdio-1.0+  main-is: Spec.hs+  hs-source-dirs:+    test+  build-depends:+    base >=4.5 && <5,+    here,+    hspec,+    bytestring,+    text+  other-modules:+    Data.String.HereSpec+  default-language: Haskell2010
src/Data/String/Here/Interpolated.hs view
@@ -5,6 +5,7 @@ module Data.String.Here.Interpolated (i, iTrim, template) where  import Control.Applicative hiding ((<|>))+import Control.Monad import Control.Monad.State  import Data.Char
+ test/Data/String/HereSpec.hs view
@@ -0,0 +1,68 @@+{-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE OverloadedStrings #-}++module Data.String.HereSpec where++import Test.Hspec++import qualified Data.Char as Char+import qualified Data.ByteString as BS+import qualified Data.Text as T++import Data.String.Here++main :: IO ()+main = hspec spec++spec :: Spec+spec = do+  describe "i quote" $ do+    it "should interpolate a number" $ do+      let val1 :: Int+          val1   = 7878+          expect :: String+          expect = "value is 7878"+          actual :: String+          actual = [i|value is ${val1}|]+      actual `shouldBe` expect++    -- (from: https://github.com/tmhedberg/here#readme)+    it "should interpolate a String expression" $ do+      let foo :: String+          foo = "foo"+          expect :: String+          expect = "\"foo\", when capitalized, is FOO!"+          actual :: String+          actual = [i|"foo", when capitalized, is ${map Char.toUpper foo}!|]+      actual `shouldBe` expect++    it "should interpolate a number to a ByteString" $ do+      let val1 :: Int+          val1   = 3535+          expect :: BS.ByteString+          expect = "value is 3535"+          actual :: BS.ByteString+          actual = [i|value is ${val1}|]+      actual `shouldBe` expect++    it "should interpolate a number to a Text" $ do+      let val1 :: Int+          val1   = 9988+          expect :: T.Text+          expect = "value is 9988"+          actual :: T.Text+          actual = [i|value is ${val1}|]+      actual `shouldBe` expect++  -- (from: https://github.com/tmhedberg/here#readme)+  describe "here quote" $ do+    it "should be here docs" $ do+      let expect :: String+          expect = "Hello world,\n\nI am a multiline here doc!"+          actual :: String+          actual = [here|+Hello world,++I am a multiline here doc!+|]+      actual `shouldBe` expect
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}