Stuart Halloway wrote:
> concerns:
> (1) Would like to see the file after a failed test.
> (2) [...] I would be much more
> comfortable not having to rely on code to write the file first.
> Doesn't feel like a unit test.
>
> But I am much more interested in having a shared approach that all
On Thu, Apr 9, 2009 at 3:57 PM, Stuart Halloway
wrote:
>
> Three concerns:
>
> (1) Would like to see the file after a failed test.
Unit tests should write their files to the temp directory (using the
system property java.io.tmpdir). This way, unit tests do not pollute
your project directory, an
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. :-) (Th
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")
~...@
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 re