这是indexloc提供的服务,不要输入任何密码
Skip to content

Improve rackunit support with test-case, test-suite, and check-docs #8

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

Closed
wants to merge 5 commits into from

Conversation

lexi-lambda
Copy link
Member

This fixes issues #6 and #7.

The test-case macro was extremely simple to reimplement in typed racket, but test-suite is a different beast. This reimplements the test-suite macro entirely within typed racket, something that required reimplementing the current-seed parameter and the test-suite-test-case-around and test-suite-check-around functions.

The precise type of Seed is somewhat unclear from the rackunit code, since it appears to be simply threaded through the code, and it can be anything at all, in theory. However, rackunit itself uses a monad type it defines itself in the run-tests function from rackunit/text-ui, so this code assumes seeds will be of that type.

@samth
Copy link
Member

samth commented Jan 8, 2015

Awesome! Did you check if the Monad type works with the rackunit gui as well?

@samth
Copy link
Member

samth commented Jan 8, 2015

@rmculpepper Can you have a look at this as well?


(define-type test-suite-handler-down
(rackunit-test-suite (Option String) (Thunk Any) (Thunk Any) Seed -> Seed))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these Thunks need to accomodate returning multiple values -- ie, using AnyValues instead of Any?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samth Hmm, that's a good point; probably wouldn't hurt. The rest of the existing code used (Thunk Any) everywhere, so I didn't think about it, but AnyValues would probably be better.

@lexi-lambda
Copy link
Member Author

@samth It appears it does not work with the GUI runner, but it doesn't look too terribly difficult to resolve. I'll take a look and try to push a fix soon.

(define current-seed : (Parameter Seed)
(make-parameter #f))

(: test-suite-test-case-around (test-suite-handler-here -> ((Thunk Any) -> Any)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would type these as producing Void.

@lexi-lambda
Copy link
Member Author

@samth Updated with your feedback. I didn't include the AnyValues change since I'm unsure how to actually do that, since AnyValues doesn't seem to be a valid type at the moment.

The rackunit/gui support should work with the change I've made in racket/rackunit#2.

@samth
Copy link
Member

samth commented Jan 12, 2015

Merged!

@samth samth closed this Jan 12, 2015
@lexi-lambda lexi-lambda deleted the rackunit-tests branch January 15, 2015 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants