improved tests for #1416, fixed accidental scope leak in test for #1420

This commit is contained in:
Michael Ficarra
2011-06-30 11:35:29 -04:00
parent 22cee5d2d6
commit 7b5f012f79

View File

@@ -487,16 +487,22 @@ test "implicit call against control structures", ->
eq result, 'caught2'
test "#1420: things like `(fn() ->)`; there are no words for this one",
test "#1420: things like `(fn() ->)`; there are no words for this one", ->
fn = -> (f) -> f()
nonce = {}
eq nonce, (fn() -> nonce)
test "#1416: don't omit one 'new' when compiling 'new new'", ->
obj = new new Function "this.foo = 3"
eq obj.foo, 3
nonce = {}
obj = new new -> -> {prop: nonce}
eq obj.prop, nonce
test "#1416: don't omit one 'new' when compiling 'new new fn()()'", ->
fn = -> -> @a = 2
{a} = new new fn()()
eq a, 2
nonce = {}
argNonceA = {}
argNonceB = {}
fn = (a) -> (b) -> {a, b, prop: nonce}
obj = new new fn(argNonceA)(argNonceB)
eq obj.prop, nonce
eq obj.a, argNonceA
eq obj.b, argNonceB