phino 0.0.0.24 → 0.0.0.25
raw patch · 4 files changed
+12/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- phino.cabal +1/−1
- src/Rewriter.hs +3/−3
- src/Rule.hs +1/−0
- test/CLISpec.hs +7/−5
phino.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: phino-version: 0.0.0.24+version: 0.0.0.25 license: MIT synopsis: Command-Line Manipulator of 𝜑-Calculus Expressions description: Please see the README on GitHub at <https://github.com/objectionary/phino#readme>
src/Rewriter.hs view
@@ -102,7 +102,7 @@ _rewrite prog count = do let depth = _maxDepth ctx must = _must ctx- if must /= 0 && count > must+ if must /= 0 && count - 1 > must then throwIO (ContinueAfter must) else if count - 1 == depth@@ -115,7 +115,7 @@ if rewritten == prog then do logDebug "No rule matched, rewriting is stopped"- if must /= 0 && count /= must- then throwIO (StoppedBefore must count)+ if must /= 0 && count - 1 /= must+ then throwIO (StoppedBefore must (count - 1)) else pure rewritten else _rewrite rewritten (count + 1)
src/Rule.hs view
@@ -161,6 +161,7 @@ where partOf :: Expression -> [Binding] -> Bool partOf expr [] = False+ partOf expr (BiTau _ (ExFormation bds) : rest) = expr == ExFormation bds || partOf expr bds || partOf expr rest partOf expr (BiTau _ expr' : rest) = expr == expr' || partOf expr rest partOf expr (bd : rest) = partOf expr rest
test/CLISpec.hs view
@@ -178,13 +178,15 @@ ["rewrite", "--nothing", "--output=xmir", "--omit-listing"] ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<object", "<listing>4 lines of phi</listing>", " <o base=\"Q.y\" name=\"x\"/>"] - it "fails with --nothing and --must=2" $- withStdin "Q -> [[ ]]" $- testCLIFailed ["rewrite", "--nothing", "--must=2"] "it's expected exactly 2 rewriting cycles happened, but rewriting stopped after 1"+ it "does not fail on exactly 1 rewrtingin" $+ withStdin "{⟦ t ↦ ⟦ x ↦ \"foo\" ⟧ ⟧}" $+ testCLI+ ["rewrite", "--rule=test-resources/cli/simple.yaml", "--must=1", "--sweet"]+ ["x ↦ \"bar\""] - it "does not fail with --nothing and --must" $+ it "fails with --nothing and --must" $ withStdin "Q -> [[ ]]" $- testCLI ["rewrite", "--nothing", "--must"] ["Φ ↦ ⟦ ρ ↦ ∅ ⟧"]+ testCLIFailed ["rewrite", "--nothing", "--must"] "it's expected exactly 1 rewriting cycles happened, but rewriting stopped after 0" it "fails with --normalize and --must" $ withStdin "Q -> [[ x -> [[ y -> 5 ]].y ]].x" $