1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 10:03:22 +03:00
juvix/test/Core/Transformation/Base.hs

32 lines
875 B
Haskell
Raw Normal View History

module Core.Transformation.Base where
import Base
import Core.Eval.Base
import Core.Eval.Positive qualified as Eval
import Juvix.Compiler.Core.Data.InfoTable
import Juvix.Compiler.Core.Transformation
data Test = Test
{ _testTransformations :: [TransformationId],
_testAssertion :: InfoTable -> Assertion,
_testEval :: Eval.PosTest
}
fromTest :: Test -> TestTree
fromTest = mkTest . toTestDescr
2022-12-20 15:05:40 +03:00
root :: Path Abs Dir
root = relToProject $(mkRelDir "tests/Core/positive/")
toTestDescr :: Test -> TestDescr
toTestDescr Test {..} =
let Eval.PosTest {..} = _testEval
2022-12-20 15:05:40 +03:00
tRoot = root <//> _relDir
file' = tRoot <//> _file
expected' = tRoot <//> _expectedFile
in TestDescr
{ _testName = _name,
_testRoot = tRoot,
2022-12-20 15:05:40 +03:00
_testAssertion = Steps $ coreEvalAssertion file' expected' _testTransformations _testAssertion
}