Three concerns:

(1) Would like to see the file after a failed test.

(2) Also have tests that read a file, and I would be much more  
comfortable not having to rely on code to write the file first.  
Doesn't feel like a unit test.

(3) The macro is more complex than the code being tested. :-) (The net  
effect of my build.xml changes might also be...)

But I am much more interested in having a shared approach that all  
contrib users adhere to than in getting my way. :-)

Stu

> My recommendation would be to use a temporary file that is created and
> deleted in a macro or fixture.
>
> (defmacro with-tmp-properties-file [& body]
>  `(binding [*tmp-properties-file* (File/createTempFile "temp"
> ".properties")]
>     (spit *tmp-properties-file* "contents of the test file")
>     ~...@body
>     (.delete *tmp-properties-file*)))
>
> -Stuart Sierra
>
>
> On Apr 9, 1:54 pm, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
>> In r659 I added a unit test to clojure-contrib that needed to read  
>> and
>> write from the filesystem. I picked a dumb and simple convention, and
>> welcome review from other committers to move to something that is  
>> just-
>> smart-enough.
>>
>> Stu
> >


--~--~---------~--~----~------------~-------~--~----~
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
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