mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-25 22:57:55 -05:00
entire generator test file is now ignored if generators are not available
This commit is contained in:
@@ -3,32 +3,24 @@
|
||||
|
||||
# * Generator Definition
|
||||
|
||||
# ensure that these tests are only run if generators are available
|
||||
generatorsAreAvailable = ->
|
||||
for execArg in process.execArgv when execArg in ['--harmony', '--harmony-generators']
|
||||
return yes
|
||||
no
|
||||
# Using the keyword yield should not cause a syntax error.
|
||||
-> yield 0
|
||||
|
||||
if generatorsAreAvailable()
|
||||
|
||||
# Using the keyword yield should not cause a syntax error.
|
||||
-> yield 0
|
||||
|
||||
test "Generator Definition", ->
|
||||
x = ->
|
||||
yield 0
|
||||
yield 1
|
||||
yield 2
|
||||
y = x()
|
||||
z = y.next()
|
||||
eq z.value, 0
|
||||
eq z.done, false
|
||||
z = y.next()
|
||||
eq z.value, 1
|
||||
eq z.done, false
|
||||
z = y.next()
|
||||
eq z.value, 2
|
||||
eq z.done, false
|
||||
z = y.next()
|
||||
eq z.value, undefined
|
||||
eq z.done, true
|
||||
test "Generator Definition", ->
|
||||
x = ->
|
||||
yield 0
|
||||
yield 1
|
||||
yield 2
|
||||
y = x()
|
||||
z = y.next()
|
||||
eq z.value, 0
|
||||
eq z.done, false
|
||||
z = y.next()
|
||||
eq z.value, 1
|
||||
eq z.done, false
|
||||
z = y.next()
|
||||
eq z.value, 2
|
||||
eq z.done, false
|
||||
z = y.next()
|
||||
eq z.value, undefined
|
||||
eq z.done, true
|
||||
|
||||
Reference in New Issue
Block a user