File tree Expand file tree Collapse file tree 2 files changed +66
-2
lines changed Expand file tree Collapse file tree 2 files changed +66
-2
lines changed Original file line number Diff line number Diff line change @@ -1788,12 +1788,12 @@ function OutputStream(options) {
1788
1788
if ( self . tag ) self . tag . print ( output ) ;
1789
1789
output . print ( "`" ) ;
1790
1790
for ( var i = 0 ; i < self . expressions . length ; i ++ ) {
1791
- output . print ( self . strings [ i ] ) ;
1791
+ output . print ( output . to_utf8 ( self . strings [ i ] ) ) ;
1792
1792
output . print ( "${" ) ;
1793
1793
self . expressions [ i ] . print ( output ) ;
1794
1794
output . print ( "}" ) ;
1795
1795
}
1796
- output . print ( self . strings [ i ] ) ;
1796
+ output . print ( output . to_utf8 ( self . strings [ i ] ) ) ;
1797
1797
output . print ( "`" ) ;
1798
1798
} ) ;
1799
1799
DEFPRINT ( AST_BigInt , function ( output ) {
Original file line number Diff line number Diff line change @@ -429,6 +429,70 @@ pure_funcs: {
429
429
node_version: ">=4"
430
430
}
431
431
432
+ ascii_only: {
433
+ beautify = {
434
+ ascii_only : true ,
435
+ }
436
+ options = {
437
+ templates : false ,
438
+ }
439
+ input: {
440
+ console . log ( `\ud801\udc37\ud801𐐷${ 42 } \u{10437}` ) ;
441
+ }
442
+ expect_exact: "console.log(`\\ud801\\udc37\\ud801\\ud801\\udc37${42}\\u{10437}`);"
443
+ expect_stdout: "𐐷\ud801𐐷42𐐷"
444
+ // non-BMP support is platform-dependent on Node.js v4
445
+ node_version: ">=6"
446
+ }
447
+
448
+ ascii_only_templates: {
449
+ beautify = {
450
+ ascii_only : true ,
451
+ }
452
+ options = {
453
+ templates : true ,
454
+ }
455
+ input: {
456
+ console . log ( `\ud801\udc37\ud801𐐷${ 42 } \u{10437}` ) ;
457
+ }
458
+ expect_exact: "console.log(`\\ud801\\udc37\\ud801\\ud801\\udc37${42}\\ud801\\udc37`);"
459
+ expect_stdout: "𐐷\ud801𐐷42𐐷"
460
+ // non-BMP support is platform-dependent on Node.js v4
461
+ node_version: ">=6"
462
+ }
463
+
464
+ unicode: {
465
+ beautify = {
466
+ ascii_only : false ,
467
+ }
468
+ options = {
469
+ templates : false ,
470
+ }
471
+ input: {
472
+ console . log ( `\ud801\udc37\ud801𐐷${ 42 } \u{10437}` ) ;
473
+ }
474
+ expect_exact: "console.log(`\\ud801\\udc37\\ud801𐐷${42}\\u{10437}`);"
475
+ expect_stdout: "𐐷\ud801𐐷42𐐷"
476
+ // non-BMP support is platform-dependent on Node.js v4
477
+ node_version: ">=6"
478
+ }
479
+
480
+ unicode_templates: {
481
+ beautify = {
482
+ ascii_only : false ,
483
+ }
484
+ options = {
485
+ templates : true ,
486
+ }
487
+ input: {
488
+ console . log ( `\ud801\udc37\ud801𐐷${ 42 } \u{10437}` ) ;
489
+ }
490
+ expect_exact: "console.log(`𐐷\\ud801𐐷${42}𐐷`);"
491
+ expect_stdout: "𐐷\ud801𐐷42𐐷"
492
+ // non-BMP support is platform-dependent on Node.js v4
493
+ node_version: ">=6"
494
+ }
495
+
432
496
issue_4604: {
433
497
options = {
434
498
collapse_vars : true ,
You can’t perform that action at this time.
0 commit comments