-
Notifications
You must be signed in to change notification settings - Fork 26
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
Handling broken ns
forms
#20
Comments
Definitely no state. I suppose it would be reasonable to add an option to print the exceptions to standard error, but it would be better if we could return a vector of Thoughts? |
After I posted, I thought an N-argument function might be best (namespaces-in-dir <dir>) => same result as now
(namespaces-in-dir <dir> :error-log) => [same-result-as-now map-from-namespaces-to-error-info That is backward-compatible. It's also similar to Common Lisp multi-value results, so it has pedigree. |
Exactly what I was thinking. I'll accept a pull request adding this! |
I've been hacking around on this. The core function produces output like this (some keys omitted): ({:file #<File ./project.clj>,
:status :no-attempt-at-namespace
:source :standalone
{:file #<File ./src/bultitude/core.clj>,
:status :contains-namespace,
:namespace-symbol bultitude.core
:source :standalone}
{:file #<File ./test/bultitude/invalid.clj>,
:status :invalid-clojure-file
:source :standalone}) From this, Does this seem reasonable? I'll probably put this into a pre-release of Midje before submitting a pull request. A little bashing by Midje-using projects would make me more confident in the changes I've made. |
Any interest in my converting the tests into Midje? I've been adding tests, and using test-unit is seriously cramping my development style. |
No thanks, I'd rather stick to clojure.test. The other stuff looks good. |
One thing you can ask Midje to do from the repl is to load all of the test files. It uses bultitude (either
namespaces-in-dir
ornamespaces-on-classpath
) to find files that load. A problem is that new test files can contain errors in thens
statement (especially when they're created by copy-paste-and-edit). Because bultitude silently throws those files away, Midje doesn't load them, so the non-eagle-eyed user can be fooled into thinking all the tests passed, rather than that none of them were run.(That non-eagle-eyed user would be me: marick/Midje#166 )
I wonder if it would be useful for
read-ns-form
to allow the reader's complaint here:https://github.com/Raynes/bultitude/blob/master/src/bultitude/core.clj#L27
https://github.com/Raynes/bultitude/blob/master/src/bultitude/core.clj#L30
... to make it to standard out, standard error, or some state variable that could be queried by client code that cared.
(Probably best would be a second return value done the way Common Lisp does it. But we don't have that upgrade path.)
If one of these seems a reasonable thing, I'll make a pull request.
The text was updated successfully, but these errors were encountered: