Skip to content

Commit 8810aa9

Browse files
committed
Fix merging bug
1 parent 8e240b7 commit 8810aa9

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/lib/contract/contract-comment.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CommentsGenerator from "../generators/comments-generator";
44
const generator = new CommentsGenerator();
55

66
export 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;

src/lib/contract/contract.es6

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

test/lib/contract/contract.test.es6

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ test('Insert text before', (t) => {
6060
});
6161

6262
test('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

0 commit comments

Comments
 (0)