Open
Description
Disposables can be monadically combined, letting a series of non-recursive expressions producing disposables be joined into one compound disposable. This should make it possible to do something like this:
(define-compound-fixture filesystem
[dir1 (disposable-directory)]
[file1 (dir1) => (disposable-file #:parent-dir dir1)]
[file2 (dir1) => (disposable-file #:parent-dir dir1)])
And then, filesystem-fixture
should be a fixture containing a struct named "filesystem", with dir1
, file1
, and file2
fields. Helper functions should be generated for accessing the current values of the fields in terms of the current value of the fixture. A test using filesystem
might look like this:
(test-case/fixture "filesystem tests"
#:fixture filesystem
(define files (directory-list (filesystem-dir1)))
(check-equal? (length files) 2))