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

Propagate :verbose to forall macro #111

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

evnu
Copy link
Collaborator

@evnu evnu commented Apr 29, 2019

This is a follow-up to #48.

When using assertions, :verbose must be set to see the actual output if
an assertion fails. Alas, a user must actually used :verbose twice, once
for the forall macro, and once for a property if forall is used within
that macro. Example:

property "failing", [:verbose] do
    forall n <- nat(), [:verbose] do
      assert n <= 0
    end
end

This is currently necessary as we cannot share state between the two
macros. This changeset rectifies that by making the options to the
property available to the forall macro. The approach chosen here is to
use the process dictionary. This is not as functionally clean as one
might want, but it is a simple way to achieve that :verbose is only
needed once in the example above:

property "failing", [:verbose] do
    forall n <- nat() do
      assert n <= 0
    end
end

@evnu
Copy link
Collaborator Author

evnu commented Apr 29, 2019

Note that the lint error is fixed in #106.

@alfert
Copy link
Owner

alfert commented Apr 29, 2019

I really don't like the process environment, but this seems to be a reasonable solution. At least, I have not better idea. So please do a rebase and after that I will merge this PR. And after that I will make new release.

This is a follow-up to alfert#48.

When using assertions, :verbose must be set to see the actual output if
an assertion fails. Alas, a user must actually used :verbose twice, once
for the forall macro, and once for a property if forall is used within
that macro. Example:

    property "failing", [:verbose] do
        forall n <- nat(), [:verbose] do
          assert n <= 0
        end
    end

This is currently necessary as we cannot share state between the two
macros. This changeset rectifies that by making the options to the
property available to the forall macro. The approach chosen here is to
use the process dictionary. This is not as functionally clean as one
might want, but it is a simple way to achieve that :verbose is only
needed once in the example above:

    property "failing", [:verbose] do
        forall n <- nat() do
          assert n <= 0
        end
    end
@evnu evnu force-pushed the propagate-verbose-to-forall branch from 9c205d3 to 32320e9 Compare April 29, 2019 21:55
@evnu
Copy link
Collaborator Author

evnu commented Apr 29, 2019

Rebased.

@evnu evnu mentioned this pull request Apr 29, 2019
@alfert alfert merged commit ad2475e into alfert:master Apr 30, 2019
@evnu evnu deleted the propagate-verbose-to-forall branch April 30, 2019 05:17
@evnu
Copy link
Collaborator Author

evnu commented Apr 30, 2019

Thanks! I think it might be time for a new release, what do you think?

@alfert
Copy link
Owner

alfert commented Apr 30, 2019

Thanks! I think it might be time for a new release, what do you think?

Yes, this will happen today or tomorrow.

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

Successfully merging this pull request may close these issues.

2 participants