machine: fix recursion ending
[haskell/symantic-parser.git] / test / Golden / Machine.hs
index 055f15d268dae206844364510e2997fb7f3c7571..63b608a90e854aa36ab2f8ad784dcf4d1322a5f8 100644 (file)
@@ -8,7 +8,7 @@ import Data.Bool (Bool(..))
 import Data.Char (Char)
 import Control.Monad (Monad(..))
 import Data.Int (Int)
-import Data.Function (($))
+import Data.Function (($), (.))
 import Data.Functor ((<$>))
 import Data.Semigroup (Semigroup(..))
 import Data.String (String, IsString(..))
@@ -26,7 +26,7 @@ import qualified Symantic.Parser as P
 goldens :: TestTree
 goldens = testGroup "Machine" $
   (\f -> List.zipWith f (machines @Text) [1::Int ..]) $ \mach g ->
-  let machineFile = "test/Golden/Machine/G"<>show g<>".expected.txt" in
+  let machineFile = getGoldenDir $ "Machine/G"<>show g<>".expected.txt" in
   goldenVsStringDiff ("G"<>show g) goldenDiff machineFile $ do
     resetTHNameCounter
     m <- mach
@@ -36,6 +36,6 @@ goldens = testGroup "Machine" $
 machines ::
   P.InputToken inp ~ Char =>
   P.Cursorable (P.Cursor inp) =>
-  P.Machine (P.InputToken inp) repr =>
+  P.Machinable (P.InputToken inp) repr =>
   [IO (repr inp '[] String)]
-machines = P.optimizeMachine <$> grammars
+machines = P.optimizeMachine . P.optimizeGrammar <$> grammars