Skip to content

Commit 6e892bc

Browse files
committed
test: update test for multi-line error
Signed-off-by: Anton Whalley <anton@venshare.com>
1 parent 4625c9a commit 6e892bc

3 files changed

Lines changed: 26 additions & 9 deletions

File tree

test/common.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,23 @@ function SessionOutput(session, stream, timeout) {
5252
if (!this.waiting)
5353
break
5454

55-
let index = buf.indexOf('\n');
55+
let line = '';
56+
let index = 0;
57+
58+
let inv = buf.indexOf('invalid_expr');
59+
if (inv !== -1) {
60+
line = buf;
61+
index = buf.length;
62+
} else {
63+
64+
index = buf.indexOf('\n');
65+
66+
if (index === -1)
67+
break;
68+
69+
line = buf.slice(0, index);
70+
}
5671

57-
if (index === -1)
58-
break;
59-
60-
const line = buf.slice(0, index);
6172
buf = buf.slice(index + 1);
6273

6374
if (/process \d+ exited/i.test(line))
@@ -107,6 +118,7 @@ SessionOutput.prototype.wait = function wait(regexp, callback, allLines) {
107118
const lines = [];
108119

109120
function onLine(line) {
121+
// console.log(line);
110122
lines.push(line);
111123
if (self.session)
112124
debug(`[LINE][${self.session.lldb.pid}]`, line);
@@ -197,9 +209,14 @@ function Session(options) {
197209
this.stderr = new SessionOutput(this, this.lldb.stderr, timeout);
198210

199211
this.stderr.on('line', (line) => {
200-
debug('[stderr]', line);
212+
console.log("stderrorline:" + line);
213+
});
214+
215+
this.stdout.on('line', (line) => {
216+
201217
});
202218

219+
203220
// Map these methods to stdout for compatibility with legacy tests.
204221
this.wait = SessionOutput.prototype.wait.bind(this.stdout);
205222
this.waitError = SessionOutput.prototype.wait.bind(this.stderr);

test/plugin/inspect-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,11 @@ function verifyInvalidExpr(t, sess) {
658658
return teardown(t, sess, err);
659659
}
660660
t.ok(
661-
/error: error: use of undeclared identifier 'invalid_expr'/.test(line),
661+
/use of undeclared identifier 'invalid_expr'/.test(line),
662662
'invalid expression should return an error'
663663
);
664664
teardown(t, sess);
665-
});
665+
}, false);
666666
}
667667

668668
tape('v8 inspect', (t) => {

test/plugin/scan-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function testFindrefsForInvalidExpr(t, sess, next) {
2727
sess.waitError(/error:/, (err, line) => {
2828
t.error(err);
2929
t.ok(
30-
/error: error: use of undeclared identifier 'invalid_expr'/.test(line),
30+
/use of undeclared identifier 'invalid_expr'/.test(line),
3131
'invalid expression should return an error'
3232
);
3333
next();

0 commit comments

Comments
 (0)