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

unittest: allow resetting checkpoint list #6376

Open
nigredo-tori opened this issue Sep 13, 2017 · 0 comments
Open

unittest: allow resetting checkpoint list #6376

nigredo-tori opened this issue Sep 13, 2017 · 0 comments

Comments

@nigredo-tori
Copy link
Contributor

Since we don't have a property check library in Nim yet, I sometimes find myself writing tests like this:

test "foo"
  for i in 1..N:
    checkpoint("i = $#" % $i)
    check: f(i) == g(i)

This, of course, generates a lot of output on failure. There are a few alternatives, but neither of those are satisfactory:

test "foo"
  for i in 1..N:
    let f0 = f(i)
    let g0 = g(i)
    if f0 != g0:
      checkpoint("i = $#" % $i)
      check: f0 == g0

The easiest way to mitigate this that I see is just adding something like the following to unittest:

proc resetCheckpoints* =
  checkpoints = @[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant