File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ export default class ExpressionFormatter {
125
125
WS . SPACE ,
126
126
this . show ( node . expr1 ) ,
127
127
WS . SPACE ,
128
- this . show ( node . andToken ) ,
128
+ this . showNonTabular ( node . andToken ) ,
129
129
WS . SPACE ,
130
130
this . show ( node . expr2 ) ,
131
131
WS . SPACE
@@ -369,7 +369,12 @@ export default class ExpressionFormatter {
369
369
}
370
370
}
371
371
372
- // don't call this directly, always use show() instead.
372
+ // Like show(), but skips tabular formatting
373
+ private showNonTabular ( token : Token ) : string {
374
+ return this . showToken ( token ) ;
375
+ }
376
+
377
+ // don't call this directly, always use show() or showNonTabular() instead.
373
378
private showToken ( token : Token ) : string {
374
379
if ( isReserved ( token ) ) {
375
380
switch ( this . cfg . keywordCase ) {
Original file line number Diff line number Diff line change @@ -118,6 +118,17 @@ export default function supportsIndentStyle(format: FormatFn) {
118
118
;
119
119
` ) ;
120
120
} ) ;
121
+
122
+ // Regression test for issue #341
123
+ it ( 'formats BETWEEN..AND' , ( ) => {
124
+ expect (
125
+ format ( 'SELECT * FROM tbl WHERE id BETWEEN 1 AND 5000;' , { indentStyle : 'tabularLeft' } )
126
+ ) . toBe ( dedent `
127
+ SELECT *
128
+ FROM tbl
129
+ WHERE id BETWEEN 1 AND 5000;
130
+ ` ) ;
131
+ } ) ;
121
132
} ) ;
122
133
123
134
describe ( 'indentStyle: tabularRight' , ( ) => {
@@ -165,5 +176,19 @@ export default function supportsIndentStyle(format: FormatFn) {
165
176
] . join ( '\n' )
166
177
) ;
167
178
} ) ;
179
+
180
+ // Regression test for issue #341
181
+ it ( 'formats BETWEEN..AND' , ( ) => {
182
+ expect (
183
+ format ( 'SELECT * FROM tbl WHERE id BETWEEN 1 AND 5000;' , { indentStyle : 'tabularRight' } )
184
+ ) . toBe (
185
+ [
186
+ // ...comment to force multi-line array...
187
+ ' SELECT *' ,
188
+ ' FROM tbl' ,
189
+ ' WHERE id BETWEEN 1 AND 5000;' ,
190
+ ] . join ( '\n' )
191
+ ) ;
192
+ } ) ;
168
193
} ) ;
169
194
}
You can’t perform that action at this time.
0 commit comments