Skip to content

Commit 934f1bd

Browse files
authored
Merge pull request #414 from prettier-solidity/code-cov
code-cov
2 parents a850b32 + a17bad9 commit 934f1bd

4 files changed

Lines changed: 30 additions & 8 deletions

File tree

__tests__/comments/printer.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const printComment = require('../../src/comments/printer');
2+
3+
test('given an unknown comment type then printComment function should throw', () => {
4+
const mockCommentPath = { getValue: () => ({ type: 'UnknownComment' }) };
5+
6+
expect(() => {
7+
printComment(mockCommentPath);
8+
}).toThrow();
9+
});

__tests__/printer.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const genericPrint = require('../src/printer');
2+
3+
test('given an unknown module type then genericPrint function should throw', () => {
4+
const mockPath = { getValue: () => ({ type: 'UnknownModule' }) };
5+
6+
expect(() => {
7+
genericPrint(mockPath);
8+
}).toThrow();
9+
});

package-lock.json

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nodes/IfStatement.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ const IfStatement = {
5151
)
5252
);
5353
parts.push(printTrueBody(node, path, print));
54-
if (commentsBetweenIfAndElse.length) {
55-
if (node.falseBody) {
56-
parts.push(hardline);
57-
parts.push(printComments(node, path, options));
58-
}
54+
if (commentsBetweenIfAndElse.length && node.falseBody) {
55+
parts.push(hardline);
56+
parts.push(printComments(node, path, options));
5957
}
6058
parts.push(printElse(node, path, print, commentsBetweenIfAndElse));
6159

0 commit comments

Comments
 (0)