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

Report error when attempting prerequisite for private function #141

Merged
merged 2 commits into from
Jun 15, 2012

Conversation

gregspurrier
Copy link
Contributor

I took a stab at adding the error message discussed in Issue #140. Please let me know if there is a better way to approach this.

The test run now looks like:

% lein midje

FAIL at (foobar/test/core.clj:14)
    Midje could not understand something you wrote: 
        Prerequisites cannot be specified for private functions exposed with expose-testables.
FAILURE: 1 fact was not confirmed. (But 1 was.)

I'd be happy to add a corresponding test in test/midje/test/t_semi_sweet_validations.clj. Do you have any suggestions for where to put a private function for testing? Or should I test against an existing one?

@gregspurrier
Copy link
Contributor Author

BTW, I'm planning on adding some metadata to the var created by expose-testables so that the original namespace will be available when generating the error message. That way we can give a helpful suggestion like "Instead refer to the private var directly. E.g.,: #'foo.core/private-function".

@gregspurrier
Copy link
Contributor Author

I improved the error message to make it more helpful. I didn't need to modify expose-testables after all. The metadata already had the namespace.

Here's the new output:

% lein midje

FAIL at (foobar/test/core.clj:14)
    Midje could not understand something you wrote: 
        A prerequisite cannot be specified on a function exposed via expose-testables.
        Instead, specify it directly on the var: #'foobar.core/private-function
FAILURE: 1 fact was not confirmed. (But 1 was.)

marick added a commit that referenced this pull request Jun 15, 2012
Report error when attempting prerequisite for private function
@marick marick merged commit 9ebfa44 into marick:master Jun 15, 2012
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