mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Iss4248 unicode code point escapes (cleanup) (#4522)
* Fix #4248: Unicode code point escapes * rewrite unicode code point escapes as unicode escapes * smarter defaults * and resimplify * correct surrogate pairs * fixes from code review * handle adjacent code point escapes * smarter regex * fix from code review * refactor toJS() to shared test helper
This commit is contained in:
committed by
Geoffrey Booth
parent
96b6c5f65a
commit
ac1b2b5c30
@@ -36,12 +36,6 @@
|
||||
# CoffeeScript also supports optional commas within `{ … }`.
|
||||
|
||||
|
||||
# Helper function
|
||||
toJS = (str) ->
|
||||
CoffeeScript.compile str, bare: yes
|
||||
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
|
||||
|
||||
|
||||
# Import statements
|
||||
|
||||
test "backticked import statement", ->
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
# * Regexen
|
||||
# * Heregexen
|
||||
|
||||
# Helper function
|
||||
toJS = (str) ->
|
||||
CoffeeScript.compile str, bare: yes
|
||||
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
|
||||
|
||||
|
||||
test "basic regular expression literals", ->
|
||||
ok 'a'.match(/a/)
|
||||
ok 'a'.match /a/
|
||||
|
||||
@@ -7,12 +7,6 @@
|
||||
# * Strings
|
||||
# * Heredocs
|
||||
|
||||
# Helper function
|
||||
toJS = (str) ->
|
||||
CoffeeScript.compile str, bare: yes
|
||||
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
|
||||
|
||||
|
||||
test "backslash escapes", ->
|
||||
eq "\\/\\\\", /\/\\/.source
|
||||
|
||||
|
||||
@@ -15,3 +15,7 @@ arrayEgal = (a, b) ->
|
||||
|
||||
exports.eq = (a, b, msg) -> ok egal(a, b), msg or "Expected #{a} to equal #{b}"
|
||||
exports.arrayEq = (a, b, msg) -> ok arrayEgal(a,b), msg or "Expected #{a} to deep equal #{b}"
|
||||
|
||||
exports.toJS = (str) ->
|
||||
CoffeeScript.compile str, bare: yes
|
||||
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
|
||||
|
||||
Reference in New Issue
Block a user