From e13cd50175f9e59565a88d2991b91d1523a1bdab Mon Sep 17 00:00:00 2001 From: rhiannon morris Date: Wed, 4 May 2022 00:49:18 +0200 Subject: [PATCH] pokes in TAP --- tests/src/TAP.idr | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/src/TAP.idr b/tests/src/TAP.idr index f3a5b7e..3f8d63d 100644 --- a/tests/src/TAP.idr +++ b/tests/src/TAP.idr @@ -1,4 +1,5 @@ module TAP +-- [todo] extract this and Quox.Error to their own packages import public Quox.Error @@ -45,7 +46,7 @@ All ToInfo es => ToInfo (OneOf es) where export %inline ToInfo () where toInfo () = [] -export Show a => ToInfo (List (String, a)) where toInfo = map (map show) +export %inline Show a => ToInfo (List (String, a)) where toInfo = map (map show) export @@ -121,15 +122,17 @@ export %inline header : List a -> String header tests = "1..\{show $ length tests}" +private makePrefix : SnocList String -> String makePrefix [<] = "" makePrefix (xs :< x) = foldr (\a, b => "\{a}/\{b}") x xs +private %inline withPrefix : SnocList String -> TestBase -> Test withPrefix pfx b = One $ {label := "[\{makePrefix pfx}] \{b.label}"} b mutual - export + export %inline flattenWith : SnocList String -> List Test -> List Test flattenWith pfx = concatMap (flatten1With pfx) @@ -138,11 +141,11 @@ mutual flatten1With pfx (One t) = [withPrefix pfx t] flatten1With pfx (Group x ts) = flattenWith (pfx :< x) ts -export +export %inline flatten : List Test -> List Test flatten = flattenWith [<] -export +export %inline flatten1 : Test -> List Test flatten1 = flatten1With [<]