-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Allow more customisation of artificial environments #2617
Conversation
What's the use case for this? |
67dcc6d
to
1161bb4
Compare
@SeanTAllen Any situation where you want to "sandbox" some part of a program, for example for mocking in unit testing. With this change, you'll be able to supply custom input and to use a custom mechanism for the exit code (e.g. storing the exit code in another actor and having the lambda send a message to that actor.) |
I fully approve these changes, as they improve testability, nonetheless there are a lot of breaking changes in this PR. We need to also check the tutorial and the patterns repo if they need to be changed as well. |
packages/builtin/stdin.pony
Outdated
maximum number of bytes of each chunk that will be passed to the notifier. | ||
""" | ||
|
||
be dispose() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this one could be given a default implementation of => None
?
This would make it easier to implement the InputStream
interface in cases where there is nothing that needs to be disposed. For example, if you wanted to mock program input from a String.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll add that.
It is now allowed to supply a custom input stream and a custom exit code handler to the user-exposed constructor of Env, allowing full customisation of the artificial environment.
1161bb4
to
b11c75b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea and the implementation both seem good to me.
I want to get a thumbs up or at least an agnostic shrug from @SeanTAllen before merging, though, since he expressed some skepticism.
Or I could merge it 😁 |
It is now allowed to supply a custom input stream and a custom exit code handler to the user-exposed constructor of Env, allowing full customisation of the artificial environment.
Manual changelog entry included.