From 0b1d4d374ad81d30fe5a2ebfdd0a7a7d73a34028 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Fri, 1 Feb 2013 22:07:19 +1100 Subject: [PATCH] Adding a test for #2613 --- test/assignment.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/assignment.coffee b/test/assignment.coffee index f4ef22cc..2f2914a0 100644 --- a/test/assignment.coffee +++ b/test/assignment.coffee @@ -293,10 +293,10 @@ test "#1627: prohibit conditional assignment of undefined variables", -> doesNotThrow (-> CoffeeScript.compile "x = null; do -> x ?= 10"), "allow (x = null; do -> x ?= 10)" doesNotThrow (-> CoffeeScript.compile "x = null; do -> x ||= 10"), "allow (x = null; do -> x ||= 10)" doesNotThrow (-> CoffeeScript.compile "x = null; do -> x or= 10"), "allow (x = null; do -> x or= 10)" - + throws (-> CoffeeScript.compile "-> -> -> x ?= 10"), null, "prohibit (-> -> -> x ?= 10)" doesNotThrow (-> CoffeeScript.compile "x = null; -> -> -> x ?= 10"), "allow (x = null; -> -> -> x ?= 10)" - + test "more existential assignment", -> global.temp ?= 0 eq global.temp, 0 @@ -311,7 +311,7 @@ test "#1348, #1216: existential assignment compilation", -> eq nonce, b #the first ?= compiles into a statement; the second ?= compiles to a ternary expression eq a ?= b ?= 1, nonce - + if a then a ?= 2 else a = 3 eq a, nonce @@ -375,3 +375,8 @@ test '#2532: compound assignment with terminator', -> ! " """ + +test "#2613: parens on LHS of destructuring", -> + a = {} + [(a).b] = [1, 2, 3] + eq a.b, 1