File tree Expand file tree Collapse file tree 3 files changed +4
-7
lines changed
Expand file tree Collapse file tree 3 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import CommentsGenerator from "../generators/comments-generator";
44const generator = new CommentsGenerator ( ) ;
55
66export function insertComment ( contract , node ) {
7- let comment = generator . generate ( node ) ;
7+ let comment = generator . generate ( node ) . trim ( ) ;
88 if ( ! comment ) return ;
99 let commentLines = comment . split ( '\n' ) ;
1010 if ( updateComment ( contract , commentLines , node . loc ) ) return ;
Original file line number Diff line number Diff line change @@ -86,9 +86,8 @@ export class Contract {
8686 let offsetAmount = 0 ;
8787 for ( let offset in this . offsets ) {
8888 if ( this . offsets . hasOwnProperty ( offset ) ) {
89- if ( line >= offset ) {
90- offsetAmount += this . offsets [ offset ] ;
91- }
89+ //if (line >= offset)
90+ offsetAmount += this . offsets [ offset ] ;
9291 }
9392 }
9493 return offsetAmount ;
Original file line number Diff line number Diff line change @@ -60,14 +60,12 @@ test('Insert text before', (t) => {
6060} ) ;
6161
6262test ( 'Insert text before with offset' , ( t ) => {
63- t . plan ( 4 ) ;
63+ t . plan ( 3 ) ;
6464 let contract = new Contract ( [ 'line1' , 'line2' ] ) ;
6565 contract . insertTextBefore ( 'test1\nbla' , 0 ) ;
6666 t . equal ( contract . getLineAt ( 0 ) , 'test1' ) ;
6767 t . equal ( contract . getLineAt ( 1 ) , 'bla' ) ;
68- contract . insertLinesBefore ( 'offset' . split ( ) , 0 ) ;
6968 t . equal ( contract . offset ( 0 ) , 2 ) ;
70- t . equal ( contract . getLineAt ( 2 ) , 'offset' ) ;
7169} ) ;
7270
7371
You can’t perform that action at this time.
0 commit comments