openllb / hlb

A developer-first language to build and test any software efficiently
https://openllb.github.io/hlb/
Apache License 2.0
108 stars 12 forks source link

Fix race in TestInputSteerer #319

Closed aaronlehmann closed 2 years ago

aaronlehmann commented 2 years ago

The assertion

require.Equal(t, "b", string(p2[:n]))

would not always succeed, because the InputSteerer may have read "b" from the input before the test pushed the new writer.

Fix this by allowing the reads from the input to progress one byte at a time, and blocking the read of the second byte until the new writer has been pushed.