]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Foldable/Test.hs
Improve handling of metadata in grammars.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Foldable / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Foldable.Test where
3
4 import Test.Tasty
5
6 import Data.Proxy (Proxy(..))
7 import Prelude hiding ((&&), not, (||))
8
9 import Language.Symantic.Lib
10 import Compiling.Test
11
12 type SS =
13 [ Proxy (->)
14 , Proxy Int
15 , Proxy Integer
16 , Proxy []
17 , Proxy ()
18 , Proxy (,)
19 , Proxy Foldable
20 ]
21 (==>) = test_readTe @() @SS
22
23 tests :: TestTree
24 tests = testGroup "Foldable"
25 [ {-"[]" ==> Right (tyList (tyVar "a" varZ), [], "[]")
26 ,-} "[1, 2, 3]" ==> Right (tyList tyInteger, [1, 2, 3], "1 : 2 : 3 : []")
27 , "1 : 2 : 3 : []" ==> Right (tyList tyInteger, [1, 2, 3], "1 : 2 : 3 : []")
28 , "foldMap (\\(x0:Integer) -> [x0, x0]) [1, 2, 3]" ==> Right
29 ( tyList tyInteger
30 , [1, 1, 2, 2, 3, 3]
31 , "foldMap (\\x0 -> x0 : x0 : []) (1 : 2 : 3 : [])" )
32 ]