1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
{-# LANGUAGE QuasiQuotes, ExtendedDefaultRules, CPP #-}
module Main where
import Data.Text
import Data.String.QQ
import Test.HUnit
#if (__GLASGOW_HASKELL__ >= 700)
test0 = assertBool "" ([s||] == "")
test1 = assertBool "" ([s|1|] == "1")
test2 = assertBool "" ([s|2|] == pack "2")
test0' = assertBool "" ([s|
|] == "")
test1' = assertBool "" ([s|
1|] == "1")
test2' = assertBool "" ([s|
2|] == pack "2")
#else
test0 = assertBool "" ([$s||] == "")
test1 = assertBool "" ([$s|1|] == "1")
test2 = assertBool "" ([$s|2|] == pack "2")
test0' = assertBool "" ([$s|
|] == "")
test1' = assertBool "" ([$s|
1|] == "1")
test2' = assertBool "" ([$s|
2|] == pack "2")
#endif
tests = TestList
[ TestLabel "Empty String" $ TestCase test0
, TestLabel "String instance" $ TestCase test1
, TestLabel "Text instance" $ TestCase test2
, TestLabel "Empty String with trimmed leading newline" $ TestCase test0'
, TestLabel "String instance with trimmed leading newline" $ TestCase test1'
, TestLabel "Text instance with trimmed leading newline" $ TestCase test2'
]
main = runTestTT tests
|