Lift.hs 790 Bytes
Newer Older
1
2
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
Bodigrim's avatar
Bodigrim committed
3
module Tests.Lift
4
5
6
7
8
9
10
  ( tests
  )
  where

import qualified Data.Text as S
import qualified Data.Text.Lazy as L
import Language.Haskell.TH.Syntax (lift)
Bodigrim's avatar
Bodigrim committed
11
12
import Test.Tasty.HUnit (testCase, assertEqual)
import Test.Tasty (TestTree, testGroup)
13

Bodigrim's avatar
Bodigrim committed
14
15
16
tests :: TestTree
tests = testGroup "TH lifting Text"
  [ testCase "strict" $ assertEqual "strict"
17
18
      $(lift ("foo" :: S.Text))
      ("foo" :: S.Text)
19
20
21
  , testCase "strict0" $ assertEqual "strict0"
      $(lift ("f\0o\1o\2" :: S.Text))
      ("f\0o\1o\2" :: S.Text)
Bodigrim's avatar
Bodigrim committed
22
  , testCase "lazy" $ assertEqual "lazy"
23
24
      $(lift ("foo" :: L.Text))
      ("foo" :: L.Text)
25
26
27
  , testCase "lazy0" $ assertEqual "lazy0"
      $(lift ("f\0o\1o\2" :: L.Text))
      ("f\0o\1o\2" :: L.Text)
28
  ]