mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Adding test case: do (x = y) -> overrides existing x value
This commit is contained in:
parent
cfb9cb6fe9
commit
0f1dbffa40
1 changed files with 9 additions and 6 deletions
|
@ -509,29 +509,32 @@ test "#1416: don't omit one 'new' when compiling 'new new fn()()'", ->
|
|||
|
||||
test "#1840: accessing the `prototype` after function invocation should compile", ->
|
||||
doesNotThrow -> CoffeeScript.compile 'fn()::prop'
|
||||
|
||||
|
||||
nonce = {}
|
||||
class Test then id: nonce
|
||||
|
||||
dotAccess = -> Test::
|
||||
protoAccess = -> Test
|
||||
|
||||
|
||||
eq dotAccess().id, nonce
|
||||
eq protoAccess()::id, nonce
|
||||
|
||||
test "#960: improved 'do'", ->
|
||||
|
||||
|
||||
do (nonExistent = 'one') ->
|
||||
eq nonExistent, 'one'
|
||||
|
||||
|
||||
overridden = 1
|
||||
do (overridden = 2) ->
|
||||
eq overridden, 2
|
||||
|
||||
two = 2
|
||||
do (one = 1, two, three = 3) ->
|
||||
eq one, 1
|
||||
eq two, 2
|
||||
eq three, 3
|
||||
|
||||
|
||||
ret = do func = (two) ->
|
||||
eq two, 2
|
||||
func
|
||||
eq ret, func
|
||||
|
Loading…
Reference in a new issue