Tests for IO.read().

This commit is contained in:
Bob Nystrom
2015-01-11 21:47:29 -08:00
parent 7a7c7a8fad
commit 1d9445d9bc
8 changed files with 44 additions and 5 deletions

13
test/io/read.wren Normal file
View File

@ -0,0 +1,13 @@
var a = IO.read("a:") // stdin: first
var b = IO.read("b:") // stdin: second
IO.print
// Using write() here because the read lines include the trailing newline.
IO.write(a)
IO.write(b)
// Since stdin isn't echoed back to stdout, we don't see the input lines here,
// and there is no newline between the two prompts since that normally comes
// from the input itself.
// expect: a:b:
// expect: first
// expect: second

View File

@ -0,0 +1 @@
IO.read(null) // expect runtime error: Prompt must be a string.