test: improve coverage

This commit is contained in:
Evan You
2019-09-24 16:35:01 -04:00
parent e67084e5a1
commit cae03f616d
8 changed files with 318 additions and 52 deletions

View File

@@ -277,6 +277,7 @@ function genNode(node: CodegenNode, context: CodegenContext) {
genArrayExpression(node, context)
break
default:
/* istanbul ignore next */
__DEV__ &&
assert(false, `unhandled codegen node type: ${(node as any).type}`)
}
@@ -399,7 +400,7 @@ function genFor(node: ForNode, context: CodegenContext) {
}
if (keyAlias) {
if (!valueAlias) {
push(`_`)
push(`__value`)
}
push(`, `)
genExpression(keyAlias, context)
@@ -407,9 +408,9 @@ function genFor(node: ForNode, context: CodegenContext) {
if (objectIndexAlias) {
if (!keyAlias) {
if (!valueAlias) {
push(`_, __`)
push(`__value, __key`)
} else {
push(`__`)
push(`, __key`)
}
}
push(`, `)
@@ -447,12 +448,9 @@ function genObjectExpression(node: ObjectExpression, context: CodegenContext) {
// value
genExpression(value, context)
if (i < properties.length - 1) {
if (multilines) {
push(`,`)
newline()
} else {
push(`, `)
}
// will only reach this if it's multilines
push(`,`)
newline()
}
}
multilines && deindent()