improved yield return test

This commit is contained in:
Andreas Lubbe
2015-02-17 19:04:26 +01:00
parent feee6954a6
commit b6012c4617

View File

@@ -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 =