Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builtin: implement unbuffer_stdout/0 (#20662)
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import time | ||
|
||
fn test_unbuffer_stdout() { | ||
// TODO: add a more extensive test, perhaps using expect, | ||
// that does not require an active user to verify its validity. | ||
// Currently this just tests that unbuffer_stdout/0 can be called, | ||
// and its effects can be observed by commenting the call to it, | ||
// on the next line, and then re-running the test: | ||
unbuffer_stdout() | ||
print('#---') | ||
for i in 0 .. 21 { | ||
print('\b\b\b> ${i:02}') | ||
time.sleep(20 * time.millisecond) | ||
} | ||
println('\b\b\b done') | ||
assert true | ||
} |