increase test coverage, handle immediately-closed blocks

pull/1158/head
Rich Harris 7 years ago
parent 198f132b28
commit bc6ee3ef9f

@ -6,7 +6,7 @@ import { Parser } from '../index';
import { Node } from '../../interfaces';
function trimWhitespace(block: Node, trimBefore: boolean, trimAfter: boolean) {
if (!block.children) return; // AwaitBlock
if (!block.children || block.children.length === 0) return; // AwaitBlock
const firstChild = block.children[0];
const lastChild = block.children[block.children.length - 1];

@ -1,3 +1,5 @@
{{#each things as thing}}
{{/each}}
{{/each}}
{{#each things as thing}}{{/each}}

@ -1,8 +1,18 @@
[{
"message": "Empty block",
"loc": {
"line": 1,
"column": 0
[
{
"message": "Empty block",
"loc": {
"line": 1,
"column": 0
},
"pos": 0
},
"pos": 0
}]
{
"message": "Empty block",
"loc": {
"line": 5,
"column": 0
},
"pos": 38
}
]

@ -1,3 +1,5 @@
{{#each things as thing}}
{{/each}}
{{/each}}
{{#each things as thing}}{{/each}}
Loading…
Cancel
Save