mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
corrections for octal escape sequences; allows "\0" alone; see #1547
Relevant sections of the spec: * http://es5.github.com/#C * http://es5.github.com/#B.1.2 * http://es5.github.com/#x7.8.4
This commit is contained in:
@@ -18,9 +18,9 @@
|
||||
|
||||
# helper to assert that code complies with strict prohibitions
|
||||
strict = (code, msg) ->
|
||||
throws (-> CoffeeScript.compile code), null, msg
|
||||
throws (-> CoffeeScript.compile code), null, msg ? code
|
||||
strictOk = (code, msg) ->
|
||||
doesNotThrow (-> CoffeeScript.compile code), msg
|
||||
doesNotThrow (-> CoffeeScript.compile code), msg ? code
|
||||
|
||||
|
||||
test "octal integer literals prohibited", ->
|
||||
@@ -32,19 +32,28 @@ test "octal integer literals prohibited", ->
|
||||
strictOk '`01`'
|
||||
|
||||
test "octal escape sequences prohibited", ->
|
||||
strict '"\\0"'
|
||||
strict '"\\1"'
|
||||
strict '"\\7"'
|
||||
strict '"\\000"'
|
||||
strict '"\\001"'
|
||||
strict '"\\777"'
|
||||
strict '"_\\0"'
|
||||
strict '"\\0_"'
|
||||
strict '"_\\0_"'
|
||||
strict '"\\08"'
|
||||
strict '"\\\\\\0"'
|
||||
strict '"_\\1"'
|
||||
strict '"\\1_"'
|
||||
strict '"_\\1_"'
|
||||
strict '"\\\\\\1"'
|
||||
strictOk '"\\0"'
|
||||
eq "\x00", "\0"
|
||||
strictOk '"\\08"'
|
||||
eq "\x008", "\08"
|
||||
strictOk '"\\0\\8"'
|
||||
eq "\x008", "\0\8"
|
||||
strictOk '"\\8"'
|
||||
strictOk '"\\\\0"'
|
||||
strictOk '"\\\\\\\\0"'
|
||||
strictOk "`'\\0'`"
|
||||
eq "8", "\8"
|
||||
strictOk '"\\\\1"'
|
||||
eq "\\" + "1", "\\1"
|
||||
strictOk '"\\\\\\\\1"'
|
||||
eq "\\\\" + "1", "\\\\1"
|
||||
strictOk "`'\\1'`"
|
||||
eq "\\" + "1", `"\\1"`
|
||||
|
||||
|
||||
test "duplicate property definitions in object literals are prohibited", ->
|
||||
|
||||
Reference in New Issue
Block a user