put the reason first in todoWith/skipWith

it means less messing around when adding/removing skipWith, and
todoWith is just changed for consistency
This commit is contained in:
rhiannon morris 2022-05-27 13:29:43 +02:00
parent ea0ae8f127
commit fdac74820c

14
TAP.idr
View file

@ -99,11 +99,11 @@ export
test : (ToInfo e, ToInfo a) => String -> Lazy (Either e a) -> Test test : (ToInfo e, ToInfo a) => String -> Lazy (Either e a) -> Test
test label val = testIO label $ MkEitherT $ lazyToIO val test label val = testIO label $ MkEitherT $ lazyToIO val
||| a todo with a reason given. the reason is the first argument, e.g. ||| a todo with a reason given, e.g.
||| `todo "<reason>" "<label>"` prints as `ok 1 - <label> # todo <reason>` ||| `todo "<reason>" "<label>"` prints as `ok 1 - <label> # todo <reason>`
export export
todoWith : String -> String -> Test todoWith : (reason, label : String) -> Test
todoWith reason label = One $ MakeTest label $ pure $ Todo reason todoWith {reason, label} = One $ MakeTest label $ pure $ Todo reason
||| a todo with no reason listed ||| a todo with no reason listed
export export
@ -111,14 +111,14 @@ todo : String -> Test
todo = todoWith "" todo = todoWith ""
private private
makeSkip : String -> String -> Test makeSkip : (reason, label : String) -> Test
makeSkip label reason = One $ MakeTest label $ pure $ Skip reason makeSkip {reason, label} = One $ MakeTest label $ pure $ Skip reason
||| skip a test, with the reason given. skipping a `Note` doesn't do anything ||| skip a test, with the reason given. skipping a `Note` doesn't do anything
export export
skipWith : String -> Test -> Test skipWith : String -> Test -> Test
skipWith reason (One t) = makeSkip t.label reason skipWith reason (One t) = makeSkip {reason, label = t.label}
skipWith reason (Group l _) = makeSkip l reason skipWith reason (Group l _) = makeSkip {reason, label = l}
skipWith _ (Note n) = Note n skipWith _ (Note n) = Note n
||| skip a test with no reason listed ||| skip a test with no reason listed