Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa2fbf0

Browse files
minor enhancements to tests for jashkenas#1005
1 parent c3fe294 commit fa2fbf0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/assignment.coffee

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,12 @@ test "#1024", ->
254254

255255
test "#1005: invalid identifiers allowed on LHS of destructuring assignment", ->
256256
disallowed = ['eval', 'arguments'].concat CoffeeScript.RESERVED
257-
throws -> CoffeeScript.compile "[#{disallowed.join ', '}] = x"
258-
throws -> CoffeeScript.compile "[#{disallowed.join '..., '}...] = x"
257+
throws (-> CoffeeScript.compile "[#{disallowed.join ', '}] = x"), null, 'all disallowed'
258+
throws (-> CoffeeScript.compile "[#{disallowed.join '..., '}...] = x"), null, 'all disallowed as splats'
259+
t = tSplat = null
259260
for v in disallowed when v isnt 'class' # `class` by itself is an expression
260-
throws -> CoffeeScript.compile "[#{v}] = x"
261-
throws -> CoffeeScript.compile "[#{v}...] = x"
261+
throws (-> CoffeeScript.compile t), null, t = "[#{v}] = x"
262+
throws (-> CoffeeScript.compile tSplat), null, tSplat = "[#{v}...] = x"
262263
doesNotThrow ->
263264
for v in disallowed
264265
CoffeeScript.compile "[a.#{v}] = x"

0 commit comments

Comments
 (0)