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
1 changed files with 7 additions and 7 deletions

14
TAP.idr
View File

@ -99,11 +99,11 @@ export
test : (ToInfo e, ToInfo a) => String -> Lazy (Either e a) -> Test
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>`
export
todoWith : String -> String -> Test
todoWith reason label = One $ MakeTest label $ pure $ Todo reason
todoWith : (reason, label : String) -> Test
todoWith {reason, label} = One $ MakeTest label $ pure $ Todo reason
||| a todo with no reason listed
export
@ -111,14 +111,14 @@ todo : String -> Test
todo = todoWith ""
private
makeSkip : String -> String -> Test
makeSkip label reason = One $ MakeTest label $ pure $ Skip reason
makeSkip : (reason, label : String) -> Test
makeSkip {reason, label} = One $ MakeTest label $ pure $ Skip reason
||| skip a test, with the reason given. skipping a `Note` doesn't do anything
export
skipWith : String -> Test -> Test
skipWith reason (One t) = makeSkip t.label reason
skipWith reason (Group l _) = makeSkip l reason
skipWith reason (One t) = makeSkip {reason, label = t.label}
skipWith reason (Group l _) = makeSkip {reason, label = l}
skipWith _ (Note n) = Note n
||| skip a test with no reason listed