mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
improved yield return test
This commit is contained in:
@@ -40,12 +40,15 @@ test "last line yields are returned", ->
|
||||
|
||||
test "yield return can be used anywhere in the function body", ->
|
||||
x = do ->
|
||||
if true
|
||||
yield return true
|
||||
return false
|
||||
if 2 is yield 1
|
||||
yield return 42
|
||||
throw new Error "this code shouldn't be reachable"
|
||||
|
||||
y = x.next()
|
||||
ok y.value is true and y.done is true
|
||||
ok y.value is 1 and y.done is false
|
||||
|
||||
y = x.next 2
|
||||
ok y.value is 42 and y.done is true
|
||||
|
||||
test "bound generator", ->
|
||||
obj =
|
||||
|
||||
Reference in New Issue
Block a user