-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle end of channel in Seq
API
#95
Conversation
In gildor478#92 @kit-ty-kate added support for the `Seq` API instead of the Stream API to be compatible with OCaml 5, which is very convenient, as we are approaching a release. While attempting to port the `gettext` unit tests which use `assert_command` I ran into the issue that migrating the tests to the `Seq` API was simple but they were always failing with an `End_of_file` exception. Upon further inspection I realized the issue must be in ounit, and indeed: the previous code used `Stream.of_channel` which presumably handled `End_of_file` while the new `Seq` API would build an infinite `Seq`, attempting to read from the end of a channel, even if it was already at the end. This changes the code to implement a functionality similar to `Stream.of_channel`. Attempting to run the `gettext` unit tests succeeds without issues with this patch.
This patch requires a release of ounit that incorporates the fix in gildor478/ounit#95 for the `Seq` API to correctly handle the end of the channel.
Hi @gildor478, do you have a moment to look into this? I am trying to unblock as many packages as possible for compatibility with OCaml 5.0 and getting gettext working via this PR would potentially allow an additional 1728 packages to build on OCaml 5.0. |
It's not really true. It's only counted high in the revdeps count because it was once a dependency of OASIS. But not anymore. Apart from older versions of OASIS no packages are really using |
Well fair enough, however fixing the issue won't hurt in any case.
|
This patch requires a release of ounit that incorporates the fix in gildor478/ounit#95 for the `Seq` API to correctly handle the end of the channel.
CHANGES: ### Fixed - Handle end of channel in Seq API. gildor478/ounit#95, @Leonidas-from-XIV - Windows and OCaml 5 compatibility. gildor478/ounit#96, @MisterDA ### Changed - Update to Dune 3.0 for newer stanzas and warnings. gildor478/ounit#96, @MisterDA
This patch requires a release of ounit that incorporates the fix in gildor478/ounit#95 for the `Seq` API to correctly handle the end of the channel.
In #92 @kit-ty-kate added support for the
Seq
API instead of theStream
API to be compatible with OCaml 5, which is very convenient, as we are approaching a release soonWhile attempting to port the
gettext
unit tests which useassert_command
I ran into the issue that migrating the tests to theSeq
API was simple but they were always failing with anEnd_of_file
exception.Upon further inspection I realized the issue must be in ounit, and indeed: the previous code used
Stream.of_channel
which presumably handledEnd_of_file
while the newSeq
API would build an infiniteSeq
, attempting to read from the end of a channel, even if it was already at the end.This changes the code to implement a functionality similar to
Stream.of_channel
.Attempting to run the
gettext
unit tests succeeds without issues with this patch.