File: IsStringSpec.hs

package info (click to toggle)
haskell-interpolate 0.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 100 kB
  • sloc: haskell: 435; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE QuasiQuotes #-}
module Data.String.Interpolate.IsStringSpec (main, spec) where

import           Test.Hspec

import qualified Data.Text as T
import           Data.String.Interpolate.IsString

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "[i|...|]" $ do
    it "can be used to construct String literals" $ do
      [i|foo #{23 :: Int} bar|] `shouldBe` "foo 23 bar"

    it "can be used to construct Text literals" $ do
      [i|foo #{23 :: Int} bar|] `shouldBe` T.pack "foo 23 bar"