File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -102,16 +102,16 @@ function minify(sql, options) {
102102 continue ;
103103 }
104104
105- if ( s === '\'' ) {
105+ if ( s === `'` ) {
106106 closeIdx = idx ;
107107 do {
108- closeIdx = sql . indexOf ( '\'' , closeIdx + 1 ) ;
108+ closeIdx = sql . indexOf ( `'` , closeIdx + 1 ) ;
109109 if ( closeIdx > 0 ) {
110110 let i = closeIdx ;
111111 while ( sql [ -- i ] === '\\' ) ;
112112 if ( ( closeIdx - i ) % 2 ) {
113113 let step = closeIdx ;
114- while ( ++ step < len && sql [ step ] === '\'' ) ;
114+ while ( ++ step < len && sql [ step ] === `'` ) ;
115115 if ( ( step - closeIdx ) % 2 ) {
116116 closeIdx = step - 1 ;
117117 break ;
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ const minify = require('../lib');
55const { parsingErrorCode} = require ( '../lib/error' ) ;
66const PEC = parsingErrorCode ;
77
8-
98describe ( 'Minify/Positive' , ( ) => {
109
1110 describe ( 'end-of-line detection' , ( ) => {
@@ -279,7 +278,14 @@ describe('Minify/Negative', () => {
279278 err = e . toString ( ) ;
280279 }
281280 it ( 'must contain error' , ( ) => {
282- expect ( err ) . toBe ( `SQLParsingError {${ EOL } ${ gap } code: parsingErrorCode.unclosedText${ EOL } ${ gap } error: "Unclosed text block."${ EOL } ${ gap } position: {line: 1, col: 1}${ EOL } }` ) ;
281+ const txt = [
282+ `SQLParsingError {` ,
283+ `${ gap } code: parsingErrorCode.unclosedText` ,
284+ `${ gap } error: "Unclosed text block."` ,
285+ `${ gap } position: {line: 1, col: 1}` ,
286+ `}`
287+ ] ;
288+ expect ( err ) . toBe ( txt . join ( EOL ) ) ;
283289 } ) ;
284290 } ) ;
285291
You can’t perform that action at this time.
0 commit comments