Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: proposed tweaks to testing API #179

Open
pchiusano opened this issue Oct 11, 2023 · 0 comments
Open

WIP: proposed tweaks to testing API #179

pchiusano opened this issue Oct 11, 2023 · 0 comments

Comments

@pchiusano
Copy link
Member

pchiusano commented Oct 11, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant