mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-18 13:49:59 +01:00
Tests for IO.read().
This commit is contained in:
13
test/io/read.wren
Normal file
13
test/io/read.wren
Normal 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
|
||||
1
test/io/read_arg_not_string.wren
Normal file
1
test/io/read_arg_not_string.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.read(null) // expect runtime error: Prompt must be a string.
|
||||
Reference in New Issue
Block a user