mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-16 20:28:04 +01:00
Add Stdin.isRaw.
This commit is contained in:
28
test/io/stdin/is_raw.wren
Normal file
28
test/io/stdin/is_raw.wren
Normal 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?
|
||||
Reference in New Issue
Block a user