minor enhancements to tests for #1005
This commit is contained in:
parent
c3fe29455b
commit
fa2fbf0c60
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue