v2 / vlib / builtin / builtin_unbuffer_stdout_test.v
17 lines · 16 sloc · 510 bytes · 2a68e2b7c92b6d7d70cc37fe4583c2dbf9554a8a
Raw
1import time
2
3fn test_unbuffer_stdout() {
4 // TODO: add a more extensive test, perhaps using expect,
5 // that does not require an active user to verify its validity.
6 // Currently this just tests that unbuffer_stdout/0 can be called,
7 // and its effects can be observed by commenting the call to it,
8 // on the next line, and then re-running the test:
9 unbuffer_stdout()
10 print('#---')
11 for i in 0 .. 21 {
12 print('\b\b\b> ${i:02}')
13 time.sleep(20 * time.millisecond)
14 }
15 println('\b\b\b done')
16 assert true
17}
18