mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 18:13:56 +03:00
ed78f2636b
* Embed stdlib in minijuvix library We add a new step at the beginning of the pipeline called Setup that registers the modules in the standard library with the Files effect. The standard library is then used when the Scoper queries the Files effect for modules as it resolves import statements. Use of the standard library can be disabled using the global `--no-stdlib` command-line option. * CI: Checkout submodules recursively for stdlib * Add a new `--no-stdlib` option to shell check * Poke CI * CI: Checkout submodules in the test job
41 lines
1.1 KiB
Haskell
41 lines
1.1 KiB
Haskell
module BackendC.Examples where
|
|
|
|
import BackendC.Base
|
|
import Base
|
|
import Data.FileEmbed
|
|
|
|
data ExampleTest = ExampleTest
|
|
{ _name :: String,
|
|
_relDir :: FilePath,
|
|
_mainFile :: FilePath,
|
|
_expectedDir :: FilePath,
|
|
_stdinText :: Text
|
|
}
|
|
|
|
makeLenses ''ExampleTest
|
|
|
|
exampleRoot :: FilePath
|
|
exampleRoot = "examples/milestone"
|
|
|
|
testDescr :: ExampleTest -> TestDescr
|
|
testDescr ExampleTest {..} =
|
|
let mainRoot = exampleRoot </> _relDir
|
|
expectedFile = $(makeRelativeToProject "tests/examplesExpected" >>= strToExp) </> _expectedDir </> "expected.golden"
|
|
in TestDescr
|
|
{ _testName = _name,
|
|
_testRoot = mainRoot,
|
|
_testAssertion = Steps $ clangAssertion StdlibExclude _mainFile expectedFile _stdinText
|
|
}
|
|
|
|
allTests :: TestTree
|
|
allTests =
|
|
testGroup
|
|
"Backend C milestone example tests"
|
|
(map (mkTest . testDescr) tests)
|
|
|
|
tests :: [ExampleTest]
|
|
tests =
|
|
[ ExampleTest "Validity Predicate example" "ValidityPredicates" "Tests.mjuvix" "ValidityPredicates" "",
|
|
ExampleTest "MiniTicTacToe example" "MiniTicTacToe" "MiniTicTacToe.mjuvix" "MiniTicTacToe" "aaa\n0\n10\n1\n2\n3\n3\n4\n5\n6\n7\n8\n9\n"
|
|
]
|