File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ const resultRecordRegex = /^(\d*)\^(done|running|connected|error|exit)/;
129
129
const newlineRegex = / ^ \r \n ? / ;
130
130
const endRegex = / ^ \( g d b \) \r \n ? / ;
131
131
const variableRegex = / ^ ( [ a - z A - Z _ \- ] [ a - z A - Z 0 - 9 _ \- ] * ) / ;
132
- const asyncClassRegex = / ^ ( . * ? ) , / ;
132
+ const asyncClassRegex = / ^ [ ^ , \r \n ] + / ;
133
133
134
134
export function parseMI ( output : string ) : MINode {
135
135
/*
@@ -270,11 +270,11 @@ export function parseMI(output: string): MINode {
270
270
271
271
if ( match [ 2 ] ) {
272
272
const classMatch = asyncClassRegex . exec ( output ) ;
273
- output = output . substr ( classMatch [ 1 ] . length ) ;
273
+ output = output . substring ( classMatch [ 0 ] . length ) ;
274
274
const asyncRecord = {
275
275
isStream : false ,
276
276
type : asyncRecordType [ match [ 2 ] ] ,
277
- asyncClass : classMatch [ 1 ] ,
277
+ asyncClass : classMatch [ 0 ] ,
278
278
output : [ ]
279
279
} ;
280
280
let result ;
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ import * as glob from 'glob';
5
5
export function run ( ) : Promise < void > {
6
6
// Create the mocha test
7
7
const mocha = new Mocha ( {
8
- ui : 'tdd'
8
+ ui : 'tdd' ,
9
+ useColors : true
9
10
} ) ;
10
- mocha . useColors ( true ) ;
11
11
12
12
const testsRoot = path . resolve ( __dirname , '..' ) ;
13
13
Original file line number Diff line number Diff line change @@ -2,6 +2,16 @@ import * as assert from 'assert';
2
2
import { parseMI , MINode } from '../../backend/mi_parse' ;
3
3
4
4
suite ( "MI Parse" , ( ) => {
5
+ test ( "Very simple out of band record" , ( ) => {
6
+ const parsed = parseMI ( `*stopped` ) ;
7
+ assert . ok ( parsed ) ;
8
+ assert . strictEqual ( parsed . token , undefined ) ;
9
+ assert . strictEqual ( parsed . outOfBandRecord . length , 1 ) ;
10
+ assert . strictEqual ( parsed . outOfBandRecord [ 0 ] . isStream , false ) ;
11
+ assert . strictEqual ( parsed . outOfBandRecord [ 0 ] . asyncClass , "stopped" ) ;
12
+ assert . strictEqual ( parsed . outOfBandRecord [ 0 ] . output . length , 0 ) ;
13
+ assert . strictEqual ( parsed . resultRecords , undefined ) ;
14
+ } ) ;
5
15
test ( "Simple out of band record" , ( ) => {
6
16
const parsed = parseMI ( `4=thread-exited,id="3",group-id="i1"` ) ;
7
17
assert . ok ( parsed ) ;
You can’t perform that action at this time.
0 commit comments