File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -4,21 +4,27 @@ const debug = false;
44const parser = require ( '../' ) ;
55
66const testParser = function ( sql ) {
7- let ast = parser . parse ( sql ) ;
7+ let firstAst = parser . parse ( sql ) ;
8+ let firstSql = parser . stringify ( firstAst ) ;
9+ let secondAst = parser . parse ( firstSql ) ;
10+ let secondSql = parser . stringify ( secondAst ) ;
11+
12+ if ( firstSql !== secondSql ) {
13+ console . log ( 'firstSql' , firstSql ) ;
14+ console . log ( 'secondSql' , secondSql ) ;
15+ throw 'err firstSql don\'t equals secondSql. ' ;
16+ }
817
918 if ( debug ) {
1019 console . log (
11- JSON . stringify ( ast , null , 2 )
12- ) ;
13- console . log (
14- parser . stringify ( ast )
20+ JSON . stringify ( secondAst , null , 2 )
1521 ) ;
1622 console . log (
17- parser . stringify ( parser . parse ( parser . stringify ( ast ) ) )
23+ parser . stringify ( secondAst )
1824 ) ;
1925 }
2026
21- return ast ;
27+ return secondAst ;
2228}
2329
2430
You can’t perform that action at this time.
0 commit comments