1
0
forked from Mirror/wren
Files
wren/test/function/syntax.wren

32 lines
418 B
Plaintext
Raw Normal View History

2013-11-06 07:47:47 -08:00
// Single expression body.
(fn IO.write("ok")).call // expect: ok
2013-11-05 15:40:21 -08:00
// TODO: Precedence of fn body.
2013-11-05 15:40:21 -08:00
2013-11-06 07:47:47 -08:00
// Curly body.
fn {
IO.write("ok") // expect: ok
2013-11-05 15:40:21 -08:00
}.call
2013-11-06 07:47:47 -08:00
// No trailing newline.
fn {
IO.write("ok") }.call // expect: ok
2013-11-06 07:47:47 -08:00
2013-11-05 15:40:21 -08:00
// Multiple expressions.
2013-11-06 07:47:47 -08:00
fn {
IO.write("1") // expect: 1
IO.write("2") // expect: 2
2013-11-05 15:40:21 -08:00
}.call
// Extra newlines.
2013-11-06 07:47:47 -08:00
fn {
2013-11-05 15:40:21 -08:00
IO.write("1") // expect: 1
2013-11-05 15:40:21 -08:00
IO.write("2") // expect: 2
2013-11-05 15:40:21 -08:00
}.call