Skip to content

Commit

Permalink
fix: ignore typedef name clashes for available-actions-accepted
Browse files Browse the repository at this point in the history
This wasn't actually due to test failures, just something I noticed in
passing. The generators which create the initial program are very
unlikely to pick the same names as the test will try to create -- we
leave tweaking the generators to try to exercise this sort of thing more
as future work. (Also note that adding a typedef is not an "offered"
action, so that error wouldn't be hit here, however there is no harm in
explicitly ignoring it.)

Signed-off-by: George Thomas <[email protected]>
Signed-off-by: Ben Price <[email protected]>
  • Loading branch information
georgefst authored and brprice committed Jun 21, 2023
1 parent e1b9fee commit a565a5e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion primer/test/Tests/Action/Available.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ import Primer.App (
Level (Beginner, Expert, Intermediate),
NodeSelection (..),
NodeType (..),
ProgError (ActionError, DefAlreadyExists),
Prog (..),
ProgError (ActionError, ConAlreadyExists, DefAlreadyExists, ParamAlreadyExists, TypeDefAlreadyExists),
Selection' (..),
TypeDefConsSelection (TypeDefConsSelection),
TypeDefNodeSelection (TypeDefConsNodeSelection, TypeDefParamNodeSelection),
Expand Down Expand Up @@ -450,6 +451,12 @@ tasty_available_actions_accepted = withTests 500 $
(StudentProvided, (Left (ActionError (CaseBranchAlreadyExists (PatPrim _))), _)) -> do
label "add duplicate primitive case branch"
annotate "ignoring CaseBranchAlreadyExistsPrim error as was generated constructor"
(StudentProvided, (Left (TypeDefAlreadyExists _), _)) -> do
pure ()
(StudentProvided, (Left (ConAlreadyExists _), _)) -> do
pure ()
(StudentProvided, (Left (ParamAlreadyExists _), _)) -> do
pure ()
(_, (Left err, _)) -> annotateShow err >> failure
(_, (Right _, a'')) -> ensureSHNormal a''
ensureSHNormal a = case checkAppWellFormed a of
Expand Down

0 comments on commit a565a5e

Please sign in to comment.