]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Map/Test.hs
Sync with ghc-8.2.2 and megaparsec-6.3.0.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Map / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Map.Test where
3
4 import Test.Tasty
5
6 import Data.Map.Strict (Map)
7 import Data.Proxy (Proxy(..))
8 import Data.Text as Text
9 import qualified Data.Map.Strict as Map
10
11 import Language.Symantic.Lib
12 import Compiling.Test
13
14 type SS =
15 [ Proxy (->)
16 , Proxy []
17 , Proxy Int
18 , Proxy Integer
19 , Proxy Map
20 , Proxy Char
21 , Proxy (,)
22 , Proxy Num
23 , Proxy Monoid
24 ]
25 (==>) = readTe @() @SS
26
27 tests :: TestTree
28 tests = testGroup "Map"
29 [ "Map.fromList (zipWith (,) [1, 2, 3] ['a', 'b', 'c'])" ==> Right
30 ( tyMap tyInteger tyChar
31 , Map.fromList [(1, 'a'), (2, 'b'), (3, 'c')]
32 , "Map.fromList (zipWith (\\x0 -> (\\x1 -> (x0, x1))) (1 : 2 : 3 : []) ('a' : 'b' : 'c' : []))" )
33 , Text.concat
34 [ "Map.foldrWithKey"
35 , " (\\(k:Integer) (v:Char) (acc:(Integer,[Char])) ->"
36 , " (k + fst acc, v : snd acc))"
37 , " (0, [])"
38 , " (Map.fromList (zipWith (,) [1, 2, 3] ['a', 'b', 'c']))"
39 ] ==> Right
40 ( tyInteger `tyTuple2` tyString
41 , (6, "abc")
42 , "Map.foldrWithKey (\\x0 -> (\\x1 -> (\\x2 -> (x0 + fst x2, x1 : snd x2)))) (0, []) (Map.fromList (zipWith (\\x0 -> (\\x1 -> (x0, x1))) (1 : 2 : 3 : []) ('a' : 'b' : 'c' : [])))" )
43 ]