On Sun, Sep 12, 2010 at 4:22 PM, Brian Marick <mar...@exampler.com> wrote:
> In my test framework, Midje, http://github.com/marick/Midje, a test written 
> in the most heavily syntactically-sugared form might look like this:
>
> (facts
>   (complicated-function ...some-integer...) => 5
>   (provided
>        (simple-function ...some-integer...) => 2
>        (other-function ...some-integer...) => 3
>        ...some-integer... => even?)
>   ...)
>
> A test failure could be associated with any point where there's an arrow. 
> Because (fact) is a macro, the straightforward way of getting the line number 
> gets the line number of the very beginning of the form. Is there a clever way 
> to get the line number of the arrows? (There's no hook into the reader, is 
> there?)
>
> What I'm going to do unless you save me is two things:
>
> 1) the failure messages will tell you the failure is associated with, say, 
> the 3rd arrow.
>
> 2) When emacs sends the form down to the interpreter, I'll have it annotate 
> it with the correct line numbers. That way, a simple keyboard gesture will 
> take me to the failing line.
>
> Better ideas for fallbacks?

In your macro, try printing out your input forms with *print-meta* on.

        (defmacro print-meta [& args]
          (binding [*print-meta* true]
            (prn args)))

I think you'll find some useful data in there. There won't be line
numbers on your arrows, but will be on the preceding forms.

--Chouser
http://joyofclojure.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to