]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Compiling/Applicative/Test.hs
Add tests for Compiling.
[haskell/symantic.git] / Language / Symantic / Compiling / Applicative / Test.hs
1 {-# LANGUAGE DataKinds #-}
2 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
3 module Compiling.Applicative.Test where
4
5 import Test.Tasty
6
7 import Data.Proxy (Proxy(..))
8
9 import Language.Symantic.Typing
10 import Language.Symantic.Compiling
11 import Compiling.Term.Test
12
13 -- * Tests
14 type Ifaces =
15 [ Proxy (->)
16 , Proxy Bool
17 , Proxy Maybe
18 , Proxy Applicative
19 ]
20 (==>) = test_term_from (Proxy::Proxy Ifaces)
21
22 tests :: TestTree
23 tests = testGroup "Applicative"
24 [ Syntax "<*>"
25 [ syJust [Syntax "xor" [syTrue]]
26 , syJust [syTrue]
27 ] ==> Right (tyMaybe :$ tyBool, Just False, "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) (Just True)")
28 , Syntax "*>"
29 [ syJust [syFalse]
30 , syJust [syTrue]
31 ] ==> Right (tyMaybe :$ tyBool, Just True, "Just False *> Just True")
32 , Syntax "<*"
33 [ syJust [syFalse]
34 , syJust [syTrue]
35 ] ==> Right (tyMaybe :$ tyBool, Just False, "Just False <* Just True")
36 ]