import * as assert from 'assert' ; import * as vscode from 'vscode' ; import * as myExtension from '../src/extension' ; import { MatchPositions , UnmatchedText } from '../src/plantuml/formatter/matchPositions' ; import { MultiRegExp2Match , MultiRegExp2 } from '../src/plantuml/formatter/multiRegExp2' ; suite ( "Formatter Tests" , ( ) => { test ( "Something 1" , ( ) => { assert . equal ( - 1 , [ 1 , 2 , 3 ] . indexOf ( 5 ) ) ; assert . equal ( - 1 , [ 1 , 2 , 3 ] . indexOf ( 0 ) ) ; } ) ; test ( "MatchPositions" , ( ) => { let str = "1abc 1223 efg 45666789=" ; let reg = /[a-z]+/ig ; let pos = new MatchPositions ( str ) ; let match ; while ( match = reg . exec ( str ) ) { pos . AddPosition ( match . index , reg . lastIndex - 1 ) ; } let reg2 = /(\d)\1+/ig ; for ( let t of pos . GetUnmatchedTexts ( ) ) { while ( match = reg2 . exec ( t . text ) ) { pos . AddPosition ( match . index , reg2 . lastIndex - 1 , t . offset ) ; } } let ts = "" ; for ( let t of pos . GetUnmatchedTexts ( ) ) { ts += t . text ; } assert . equal ( ts , "1 13  45789=" ) ; } ) ; test ( "MultiRegExp2" , ( ) => { let str ; let mreg ; let matches ; mreg = new MultiRegExp2 ( /(?:(b)a)?(b)/ ) ; console . log ( mreg . regExp . source ) ; } ) ; } ) ;