Skip to content

WIP: proposed tweaks to testing API #179

Open
@pchiusano

Description

Currently chicken scratch, but @SystemFw was noting some awkwardness with collecting up multiple assertions without failing fast, in a single run. We could do something like this, which also lets us label test results:

unique ability Test where
  pass : Text -> a -> ()
  fail : Text -> a -> ()
  -- this can also be used to implement 
  --   ensurePending msg payload b = if b then unexpectedPass ("pending test succeeded: " ++ msg) payload else ()
  unexpectedPass : Text -> a -> ()

-- this collects up any failures into an exception, failing fast if any fail, and discarding `pass`
Test.scope : '{g, Test} a ->{Exception,g} a

ensure/ensureEqual could have two variants now - one which is in `Exception` which fails fast and another which is in `Test` which doesn't fail fast

-- this handles `Test` and fails if `Test` produces any failures, but it also prints all the successes
verify : '{Test, Each, Random, Exception, g} a ->{g} [Result]

And then delete Gen and the other olding testing functions, so base has a canonical way of doing testing.

This Test ability I think will clean up the cloud client tests, which jump through a bunch of hoops to get additional information about failures / sucesses (it uses Exists)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions