1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-13 11:16:48 +03:00
juvix/test/Reg/Transformation/Base.hs
Łukasz Czajka 86e8458b9f
JuvixReg recursors (#2641)
* Implements JuvixReg recursors, which will allow to implement JuvixReg
transformations more succinctly and effectively.
* Adds a transformation framework to JuvixReg.
* Adds identity transformation tests.
* Depends on #2635
2024-02-19 08:58:19 +00:00

32 lines
868 B
Haskell

module Reg.Transformation.Base where
import Base
import Juvix.Compiler.Reg.Data.InfoTable
import Juvix.Compiler.Reg.Transformation
import Reg.Parse.Positive qualified as Parse
import Reg.Run.Base
data Test = Test
{ _testTransformations :: [TransformationId],
_testAssertion :: InfoTable -> Assertion,
_testRun :: Parse.PosTest
}
fromTest :: Test -> TestTree
fromTest = mkTest . toTestDescr
root :: Path Abs Dir
root = relToProject $(mkRelDir "tests/Reg/positive/")
toTestDescr :: Test -> TestDescr
toTestDescr Test {..} =
let Parse.PosTest {..} = _testRun
tRoot = root <//> _relDir
file' = tRoot <//> _file
expected' = tRoot <//> _expectedFile
in TestDescr
{ _testName = _name,
_testRoot = tRoot,
_testAssertion = Steps $ regRunAssertion file' expected' _testTransformations _testAssertion
}