Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compound fixtures #6

Open
jackfirth opened this issue Aug 29, 2017 · 0 comments
Open

Add compound fixtures #6

jackfirth opened this issue Aug 29, 2017 · 0 comments

Comments

@jackfirth
Copy link
Owner

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant