with-test-file ( ..a quot: ( ..a path -- ..b ) -- ..b ) (original) (raw)
with-test-file ( ..a quot: ( ..a path -- ..b ) -- ..b )
Factor handbook » Developer tools » Unit testing
Prev: | with-test-directory ( ..a quot: ( ..a -- ..b ) -- ..b ) |
---|---|
Next: | test ( prefix -- ) |
Inputs
quot | a quotation |
---|
Outputs
None
Word description
Creates an empty temporary file and applies the quotation to it. The file is deleted after the word returns.
Definition
USING: io.files.temp io.files.unique kernel ;
: with-test-file ( ..a quot: ( ..a path -- ..b ) -- ..b )
[ [ "" "" ] ] dip [ cleanup-unique-file ] curry compose
with-temp-directory ; inline