'use strict' ; import * as assert from 'assert' ; import { convert2RegExp } from '../utils' ; function isDefined < T > ( value ) { if ( value === undefined || value === null ) { throw new Error ( `Value is null or undefined` ) ; } } function toOSPath ( path ) { if ( process . platform !== 'win32' ) { return path ; } return path . replace ( /\//g , '\\' ) ; } suite ( 'Glob' , ( ) => { test ( 'Simple' , ( ) => { let regExp = convert2RegExp ( '/test/*/' ) ; isDefined ( regExp ) ; let matches = regExp . exec ( toOSPath ( '/test/foo/bar/file.txt' ) ) ; isDefined ( matches ) ; assert . strictEqual ( matches . length , 1 ) ; assert . strictEqual ( matches [ 0 ] , toOSPath ( '/test/foo/' ) ) ; } ) ; } ) ;