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)/;
129129const newlineRegex = / ^ \r \n ? / ;
130130const endRegex = / ^ \( g d b \) \r \n ? / ;
131131const variableRegex = / ^ ( [ a - z A - Z _ \- ] [ a - z A - Z 0 - 9 _ \- ] * ) / ;
132- const asyncClassRegex = / ^ ( . * ? ) , / ;
132+ const asyncClassRegex = / ^ [ ^ , \r \n ] + / ;
133133
134134export function parseMI ( output : string ) : MINode {
135135 /*
@@ -270,11 +270,11 @@ export function parseMI(output: string): MINode {
270270
271271 if ( match [ 2 ] ) {
272272 const classMatch = asyncClassRegex . exec ( output ) ;
273- output = output . substr ( classMatch [ 1 ] . length ) ;
273+ output = output . substring ( classMatch [ 0 ] . length ) ;
274274 const asyncRecord = {
275275 isStream : false ,
276276 type : asyncRecordType [ match [ 2 ] ] ,
277- asyncClass : classMatch [ 1 ] ,
277+ asyncClass : classMatch [ 0 ] ,
278278 output : [ ]
279279 } ;
280280 let result ;
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ import * as glob from 'glob';
55export function run ( ) : Promise < void > {
66 // Create the mocha test
77 const mocha = new Mocha ( {
8- ui : 'tdd'
8+ ui : 'tdd' ,
9+ useColors : true
910 } ) ;
10- mocha . useColors ( true ) ;
1111
1212 const testsRoot = path . resolve ( __dirname , '..' ) ;
1313
Original file line number Diff line number Diff line change @@ -2,6 +2,16 @@ import * as assert from 'assert';
22import { parseMI , MINode } from '../../backend/mi_parse' ;
33
44suite ( "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+ } ) ;
515 test ( "Simple out of band record" , ( ) => {
616 const parsed = parseMI ( `4=thread-exited,id="3",group-id="i1"` ) ;
717 assert . ok ( parsed ) ;
You can’t perform that action at this time.
0 commit comments