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

Allow more customisation of artificial environments #2617

Merged
merged 1 commit into from
Apr 3, 2018

Conversation

Praetonus
Copy link
Member

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.

@SeanTAllen
Copy link
Member

What's the use case for this?

@Praetonus
Copy link
Member Author

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

@mfelsche
Copy link
Contributor

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.

maximum number of bytes of each chunk that will be passed to the notifier.
"""

be dispose()
Copy link
Member

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.

Copy link
Member Author

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.
Copy link
Member

@jemc jemc left a 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.

@SeanTAllen SeanTAllen merged commit b1bf144 into ponylang:master Apr 3, 2018
@SeanTAllen
Copy link
Member

Or I could merge it

😁

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.

4 participants