minor enhancements to tests for #1005

This commit is contained in:
Michael Ficarra 2011-08-11 02:17:48 -04:00
parent c3fe29455b
commit fa2fbf0c60
1 changed files with 5 additions and 4 deletions

View File

@ -254,11 +254,12 @@ test "#1024", ->
test "#1005: invalid identifiers allowed on LHS of destructuring assignment", ->
disallowed = ['eval', 'arguments'].concat CoffeeScript.RESERVED
throws -> CoffeeScript.compile "[#{disallowed.join ', '}] = x"
throws -> CoffeeScript.compile "[#{disallowed.join '..., '}...] = x"
throws (-> CoffeeScript.compile "[#{disallowed.join ', '}] = x"), null, 'all disallowed'
throws (-> CoffeeScript.compile "[#{disallowed.join '..., '}...] = x"), null, 'all disallowed as splats'
t = tSplat = null
for v in disallowed when v isnt 'class' # `class` by itself is an expression
throws -> CoffeeScript.compile "[#{v}] = x"
throws -> CoffeeScript.compile "[#{v}...] = x"
throws (-> CoffeeScript.compile t), null, t = "[#{v}] = x"
throws (-> CoffeeScript.compile tSplat), null, tSplat = "[#{v}...] = x"
doesNotThrow ->
for v in disallowed
CoffeeScript.compile "[a.#{v}] = x"