]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Golden/Machine.hs
test: add goldens for TH splices
[haskell/symantic-parser.git] / test / Golden / Machine.hs
1 {-# LANGUAGE DataKinds #-} -- For using P.viewMachine
2 {-# LANGUAGE TypeApplications #-}
3 module Golden.Machine where
4
5 import Data.Bool (Bool(..))
6 import Control.Monad (Monad(..))
7 import Data.Int (Int)
8 import Data.Function (($))
9 import Data.Semigroup (Semigroup(..))
10 import Data.String (IsString(..))
11 import Test.Tasty
12 import Test.Tasty.Golden
13 import Text.Show (Show(..))
14 import qualified Data.List as List
15
16 import Golden.Utils
17 import qualified Symantic.Parser as P
18 import qualified Machine
19
20 goldens :: TestTree
21 goldens = testGroup "Machine" $
22 (\f -> List.zipWith f Machine.machines [1::Int ..]) $ \(Machine.M mach) g ->
23 let machineFile = "test/Golden/Machine/G"<>show g<>".expected.txt" in
24 goldenVsStringDiff machineFile goldenDiff machineFile $ do
25 return $ fromString $ show $
26 P.viewMachine @'False mach