Skip to content

Add compound fixtures #6

Open
Open
@jackfirth

Description

@jackfirth

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions