Add Stdin.readByte().

This commit is contained in:
Bob Nystrom
2016-05-20 11:50:14 -07:00
parent 872cfdcd42
commit 500dd41ccd
7 changed files with 140 additions and 55 deletions
+21
View File
@@ -0,0 +1,21 @@
import "io" for Stdin
for (i in 1...13) {
System.print(Stdin.readByte())
}
// stdin: first
// expect: 102
// expect: 105
// expect: 114
// expect: 115
// expect: 116
// expect: 10
// stdin: second
// expect: 115
// expect: 101
// expect: 99
// expect: 111
// expect: 110
// expect: 100
+9
View File
@@ -0,0 +1,9 @@
import "io" for Stdin
Stdin.readLine() // stdin: one line
var error = Fiber.new {
Stdin.readByte()
}.try()
System.print(error) // expect: Stdin was closed.