Commit 08fb5bec authored by isaacs's avatar isaacs

Fix double synthetic bailouts, and synthetic plans for bailed/buffered children

parent 17f06c28
......@@ -368,12 +368,12 @@ class Parser extends MiniPass {
this.emitResult()
if (this.syntheticBailout && this.level === 0) {
this.syntheticBailout = false
let reason = this.bailedOut
if (reason === true)
reason = ''
else
reason = ' ' + reason
// reason += ' Parser(384 l=' + this.level + ')'
this.emit('line', 'Bail out!' + reason + '\n')
}
......@@ -471,7 +471,6 @@ class Parser extends MiniPass {
}
bailout (reason, synthetic) {
// console.trace('bailout')
this.syntheticBailout = synthetic
if (this.bailingOut)
......@@ -493,7 +492,6 @@ class Parser extends MiniPass {
let line = 'Bail out!'
if (reason)
line += ' ' + reason
// reason += ' Parser(524 s=' + synthetic + ')'
this.emit('line', line + '\n')
}
this.emit('bailout', reason)
......@@ -511,7 +509,7 @@ class Parser extends MiniPass {
}
endChild () {
if (this.child) {
if (this.child && (!this.bailingOut || this.child.count)) {
this.child.end()
this.child = null
}
......@@ -556,7 +554,6 @@ class Parser extends MiniPass {
let p
for (p = this; p.parent; p = p.parent);
const bailName = res.name ? ' # ' + res.name : ''
// bailName += ' Parser(586)'
p.parse(ind + 'Bail out!' + bailName + '\n')
}
this.clearExtraQueue()
......
var tapContent = function () {/*
TAP version 13
ok 1 - this is fine
# Subtest: child
# this is a child
Bail out! # saw that coming
*/}.toString().split('\n').slice(1, -1).join('\n')
var P = require('../')
var etoa = require('events-to-array')
var ignore = [ 'pipe', 'unpipe', 'prefinish', 'finish', 'newListener', 'line' ]
var p = new P()
var events = etoa(p, ignore)
p.end(tapContent)
require('tap').same(events, [
[
'version',
13
],
[
'assert',
{
'ok': true,
'id': 1,
'name': 'this is fine'
}
],
[
'child',
[
[
'comment',
'# Subtest: child\n'
],
[
'comment',
'# this is a child\n'
]
]
],
[
'bailout',
'# saw that coming'
],
[
'complete',
{
'ok': false,
'count': 1,
'pass': 1,
'fail': 0,
'bailout': '# saw that coming',
'todo': 0,
'skip': 0,
'plan': {
'start': null,
'end': null,
'skipAll': false,
'skipReason': '',
'comment': ''
},
'failures': []
}
]
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment