Open akr opened 2 years ago
I found the reason to avoid Stream.t: OCaml 4.14.0 deprecated Stream. https://ocaml.org/releases/4.14.0
I still think that it is better to avoid End_of_file exception for foutput. I'm happy if I can adapt newer OCaml and OUnit by just changing Stream.iter to Seq.iter without try-with.
I found OUnit 2.2.6 changes the type of foutput option for assert_command. https://github.com/gildor478/ounit/commit/9345a4767b907e391ab48c6ccb3241015787e881
The sequence is created by seq_forever (same as Seq.forever for OCaml 4.14) which returns an infinite sequence. The end of the sequence is notified by End_of_file exception raised by input_char.
It is different from OUnit 2.2.5 which creates a finite channel by Stream.of_channel.
The difference between "finite" and "infinite" causes us to need to catch End_of_file exception.
We can write as follows in OUnit 2.2.5.
We need to rewrite it as follows with OUnit 2.2.6. It needs try-with addition to modifying from Stream.iter to Seq.iter.
I'm not sure why Stream.t is changed to Seq.t.
Even if Seq.t has a good reason, I think it is better to catch End_of_file exception in OUnit and produce a finite sequence as OUnit 2.2.5.