Merge branch 'list-forall' of git://github.com/gsmaverick/wren into gsmaverick-list-forall

This commit is contained in:
Bob Nystrom
2015-01-15 06:52:43 -08:00
6 changed files with 29 additions and 0 deletions

9
test/list/forall.wren Normal file
View File

@ -0,0 +1,9 @@
var a = [1, 2, 3]
var b = a.all {|x| x > 1 }
IO.print(b) // expect: false
var d = a.all {|x| x > 0 }
IO.print(d) // expect: true
var e = [].all {|x| false }
IO.print(e) // expect: true

View File

@ -0,0 +1 @@
[1, 2, 3].all {|x| "string" } // expect runtime error: String does not implement method '!' with 0 arguments.

View File

@ -0,0 +1 @@
[1, 2, 3].all("string") // expect runtime error: String does not implement method 'call' with 1 argument.