import * as path from 'path' ; import { Path } from '../Path' ; function toPosixPath ( value ) { return value . replace ( /[\\\/]/g , '/' ) ; } function toNativePath ( value ) { return value . replace ( /[\\\/]/g , path . sep ) ; } function relativeCaseInsensitive ( from , to ) { return toPosixPath ( Path [ '_relativeCaseInsensitive' ] ( toNativePath ( from ) , toNativePath ( to ) ) ) ; } describe ( 'Path' , ( ) => { test ( '_detectCaseSensitive()' , ( ) => { expect ( relativeCaseInsensitive ( '/' , '/' ) ) . toEqual ( '' ) ; expect ( relativeCaseInsensitive ( '/' , '/a' ) ) . toEqual ( 'a' ) ; expect ( relativeCaseInsensitive ( '/' , '/a/' ) ) . toEqual ( 'a' ) ; expect ( relativeCaseInsensitive ( '/' , '/a//' ) ) . toEqual ( 'a' ) ; expect ( relativeCaseInsensitive ( '/' , '/a/b' ) ) . toEqual ( 'a/b' ) ; expect ( relativeCaseInsensitive ( '/' , '/a/b/c' ) ) . toEqual ( 'a/b/c' ) ; expect ( relativeCaseInsensitive ( '/A' , '/a/b/c' ) ) . toEqual ( 'b/c' ) ; expect ( relativeCaseInsensitive ( '/A/' , '/a/b/c' ) ) . toEqual ( 'b/c' ) ; expect ( relativeCaseInsensitive ( '/A/B' , '/a/b/c' ) ) . toEqual ( 'c' ) ; expect ( relativeCaseInsensitive ( '/A/b/C' , '/a/b/c' ) ) . toEqual ( '' ) ; expect ( relativeCaseInsensitive ( '/a/B/c' , '/a/b/c' ) ) . toEqual ( '' ) ; expect ( relativeCaseInsensitive ( '/a/B/c/D' , '/a/b/c' ) ) . toEqual ( '..' ) ; expect ( relativeCaseInsensitive ( '/a/B/c/D' , '/a/b/c/e' ) ) . toEqual ( '../e' ) ; } ) ; } ) ;