I am using JLine3 in my application and I am trying to write some tests to ensure that a given input produces a given output. For example, for input
1 + 2;
my application should produce the output
1 + 2;
= 1 + 2;
val it = 3 : int
(The line '= 1 + 2;' is expected because JLine re-displays the input with a '= ' prompt.)
Unfortunately the output is non-deterministic. Sometimes the output is as follows:
= 1 + 2;
1 + 2;
val it = 3 : int
I think this happens because the pump (a thread that copies from input to output) is running slower than usual.
Is this non-determinism expected? Is there any way to make the results deterministic? How do other people test applications that use JLine?
Julian