File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ import { Whitespace } from "sql-parser-cst";
44export const printComment = ( path : AstPath < Whitespace > ) : string => {
55 const node = path . node ;
66 if ( node . type === "line_comment" ) {
7- if ( / ^ - - [ ^ \t ] / . test ( node . text ) ) {
7+ if ( / ^ - - [ ^ \t - ] / . test ( node . text ) ) {
88 return node . text . replace ( / ^ - - / , "-- " ) ;
99 }
10- if ( / ^ # [ ^ \t ! ] / . test ( node . text ) ) {
10+ if ( / ^ # [ ^ \t ! # ] / . test ( node . text ) ) {
1111 return node . text . replace ( / ^ # / , "# " ) ;
1212 }
1313 }
Original file line number Diff line number Diff line change @@ -170,6 +170,29 @@ describe("comments", () => {
170170 ` ) ;
171171 } ) ;
172172
173+ // Issue #67
174+ it ( `preserves ------ comments as-is` , async ( ) => {
175+ rawTest ( dedent `
176+ SELECT 1;
177+ ---------------------
178+ -- Start main block
179+ ---------------------
180+ SELECT 1;
181+
182+ ` ) ;
183+ } ) ;
184+
185+ it ( `preserves ######### comments as-is` , async ( ) => {
186+ rawTest ( dedent `
187+ SELECT 1;
188+ #####################
189+ # Start main block
190+ #####################
191+ SELECT 1;
192+
193+ ` ) ;
194+ } ) ;
195+
173196 // Issue #9
174197 it . skip ( `keeps separate-line line-comments on a separate line (not moving them to line end)` , async ( ) => {
175198 rawTest ( dedent `
You can’t perform that action at this time.
0 commit comments