Add Stdin.isRaw.

This commit is contained in:
Bob Nystrom
2016-05-20 15:19:18 -07:00
parent 500dd41ccd
commit 5d98d20175
6 changed files with 103 additions and 19 deletions

28
test/io/stdin/is_raw.wren Normal file
View File

@ -0,0 +1,28 @@
import "io" for Stdin
// Defaults to false.
System.print(Stdin.isRaw) // expect: false
// stdin: abcdefgh
for (i in 1..4) {
System.print(Stdin.readByte())
}
// expect: 97
// expect: 98
// expect: 99
// expect: 100
Stdin.isRaw = true
System.print(Stdin.isRaw) // expect: true
for (i in 1..4) {
System.print(Stdin.readByte())
}
// expect: 101
// expect: 102
// expect: 103
// expect: 104
// TODO: This doesn't actually detect a visible difference between raw and
// non-raw mode. Maybe add support to the test runner for writing non-printing
// characters to stdin?