]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/test/HUnit/Foldable.hs
Move symantic-document to its own Git repository.
[haskell/symantic.git] / symantic-lib / test / HUnit / Foldable.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module HUnit.Foldable where
3
4 import Test.Tasty
5 import Control.Applicative (Applicative)
6 import Data.Either (Either(..))
7 import Data.Foldable (Foldable)
8 import Data.Int (Int)
9 import Data.Proxy (Proxy(..))
10 import Prelude (Integer)
11
12 import Language.Symantic.Lib
13 import Testing.Compiling
14
15 type SS =
16 [ Proxy (->)
17 , Proxy Int
18 , Proxy Integer
19 , Proxy []
20 , Proxy ()
21 , Proxy (,)
22 , Proxy Foldable
23 ]
24 (==>) = readTe @() @SS
25
26 hunits :: TestTree
27 hunits = testGroup "Foldable"
28 [ {-"[]" ==> Right (tyList (tyVar "a" varZ), [], "[]")
29 ,-} "[1, 2, 3]" ==> Right (tyList tyInteger, [1, 2, 3], "1 : 2 : 3 : []")
30 , "1 : 2 : 3 : []" ==> Right (tyList tyInteger, [1, 2, 3], "1 : 2 : 3 : []")
31 , "foldMap (\\(x0:Integer) -> [x0, x0]) [1, 2, 3]" ==> Right
32 ( tyList tyInteger
33 , [1, 1, 2, 2, 3, 3]
34 , "foldMap (\\x0 -> x0 : x0 : []) (1 : 2 : 3 : [])" )
35 ]