packages feed

phino-0.0.0.12 / test / MiscSpec.hs

-- SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com-- SPDX-License-Identifier: MITmodule MiscSpec whereimport Control.Monad (forM_)import Misc (withVoidRho)import Test.Hspec (Example (Arg), Expectation, Spec, SpecWith, describe, it, shouldBe)import AsttestWithVoidRho :: [(String, [Binding], [Binding])] -> SpecWith (Arg Expectation)testWithVoidRho useCases =  forM_ useCases $ \(desc, before, after) ->    it desc $ withVoidRho before `shouldBe` afterspec :: Specspec =  describe "with void rho binding" $    testWithVoidRho      [ ( "[[x -> ?]] => [[x -> ?, ^ -> ?]]",          [BiVoid (AtLabel "x")],          [BiVoid (AtLabel "x"), BiVoid AtRho]        ),        ( "[[^ -> ?, x -> ?]] => [[^ -> ?, x -> ?]]",          [BiVoid AtRho, BiVoid (AtLabel "x")],          [BiVoid AtRho, BiVoid (AtLabel "x")]        ),        ( "[[^ -> Q.x, x -> $.y]] => [[^ -> Q.x, x -> $.y]]",          [BiTau AtRho (ExDispatch ExGlobal (AtLabel "x")), BiTau AtRho (ExDispatch ExTermination (AtLabel "y"))],          [BiTau AtRho (ExDispatch ExGlobal (AtLabel "x")), BiTau AtRho (ExDispatch ExTermination (AtLabel "y"))]        ),        ("[[!B]] => [[!B]]", [BiMeta "B"], [BiMeta "B"]),        ("[[x -> ?, !B]] => [[x -> ?, !B]]", [BiVoid (AtLabel "x"), BiMeta "B"], [BiVoid (AtLabel "x"), BiMeta "B"]),        ( "[[x -> ?, !B, y -> ?]] => [[x -> ?, !B, y -> ?]]",          [BiVoid (AtLabel "x"), BiMeta "B", BiVoid (AtLabel "y")],          [BiVoid (AtLabel "x"), BiMeta "B", BiVoid (AtLabel "y")]        ),        ( "[[^ -> ?, !B, y -> ?]] => [[^ -> ?, !B, y -> ?]]",          [BiVoid AtRho, BiMeta "B", BiVoid (AtLabel "y")],          [BiVoid AtRho, BiMeta "B", BiVoid (AtLabel "y")]        ),        ( "[[!a -> ?, x -> $.y]] => [[!a -> Q.x, x -> $.y]]",          [BiVoid (AtMeta "a"), BiTau AtRho (ExDispatch ExTermination (AtLabel "y"))],          [BiVoid (AtMeta "a"), BiTau AtRho (ExDispatch ExTermination (AtLabel "y"))]        ),        ( "[[!a -> Q.x, x -> $.y]] => [[!a -> Q.x, x -> $.y]]",          [BiTau (AtMeta "a") (ExDispatch ExGlobal (AtLabel "x")), BiTau AtRho (ExDispatch ExTermination (AtLabel "y"))],          [BiTau (AtMeta "a") (ExDispatch ExGlobal (AtLabel "x")), BiTau AtRho (ExDispatch ExTermination (AtLabel "y"))]        )      ]