Skip to content

Commit ac1b2b5

Browse files
Julian RosseGeoffreyBooth
Julian Rosse
authored andcommitted
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
1 parent 96b6c5f commit ac1b2b5

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

test/modules.coffee

-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
# CoffeeScript also supports optional commas within `{ … }`.
3737

3838

39-
# Helper function
40-
toJS = (str) ->
41-
CoffeeScript.compile str, bare: yes
42-
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
43-
44-
4539
# Import statements
4640

4741
test "backticked import statement", ->

test/regexps.coffee

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
# * Regexen
77
# * Heregexen
88

9-
# Helper function
10-
toJS = (str) ->
11-
CoffeeScript.compile str, bare: yes
12-
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
13-
14-
159
test "basic regular expression literals", ->
1610
ok 'a'.match(/a/)
1711
ok 'a'.match /a/

test/strings.coffee

-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
# * Strings
88
# * Heredocs
99

10-
# Helper function
11-
toJS = (str) ->
12-
CoffeeScript.compile str, bare: yes
13-
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace
14-
15-
1610
test "backslash escapes", ->
1711
eq "\\/\\\\", /\/\\/.source
1812

test/support/helpers.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ arrayEgal = (a, b) ->
1515

1616
exports.eq = (a, b, msg) -> ok egal(a, b), msg or "Expected #{a} to equal #{b}"
1717
exports.arrayEq = (a, b, msg) -> ok arrayEgal(a,b), msg or "Expected #{a} to deep equal #{b}"
18+
19+
exports.toJS = (str) ->
20+
CoffeeScript.compile str, bare: yes
21+
.replace /^\s+|\s+$/g, '' # Trim leading/trailing whitespace

0 commit comments

Comments
 (0)