Fix #49048 - fix querybuilder unit tests

This commit is contained in:
Rob Lourens 2018-05-02 18:55:51 -07:00
parent faeb4f48ba
commit 0ebdf8a29b

View file

@ -437,31 +437,31 @@ suite('QueryBuilder', () => {
cases.forEach(testIncludesDataItem); cases.forEach(testIncludesDataItem);
}); });
// test('includes with tilde', () => { test('includes with tilde', () => {
// const userHome = TestEnvironmentService.userHome; const userHome = TestEnvironmentService.userHome;
// const cases: [string, ISearchPathsResult][] = [ const cases: [string, ISearchPathsResult][] = [
// [ [
// '~/foo/bar', '~/foo/bar',
// <ISearchPathsResult>{ <ISearchPathsResult>{
// searchPaths: [{ searchPath: getUri(userHome, '/foo/bar') }] searchPaths: [{ searchPath: getUri(userHome, '/foo/bar') }]
// } }
// ], ],
// [ [
// '~/foo/bar, a', '~/foo/bar, a',
// <ISearchPathsResult>{ <ISearchPathsResult>{
// searchPaths: [{ searchPath: getUri(userHome, '/foo/bar') }], searchPaths: [{ searchPath: getUri(userHome, '/foo/bar') }],
// pattern: patternsToIExpression(...globalGlob('a')) pattern: patternsToIExpression(...globalGlob('a'))
// } }
// ], ],
// [ [
// fixPath('/foo/~/bar'), fixPath('/foo/~/bar'),
// <ISearchPathsResult>{ <ISearchPathsResult>{
// searchPaths: [{ searchPath: getUri('/foo/~/bar') }] searchPaths: [{ searchPath: getUri('/foo/~/bar') }]
// } }
// ], ],
// ]; ];
// cases.forEach(testIncludesDataItem); cases.forEach(testIncludesDataItem);
// }); });
test('relative includes w/single root folder', () => { test('relative includes w/single root folder', () => {
const cases: [string, ISearchPathsResult][] = [ const cases: [string, ISearchPathsResult][] = [
@ -856,16 +856,11 @@ function getUri(...slashPathParts: string[]): uri {
} }
function fixPath(...slashPathParts: string[]): string { function fixPath(...slashPathParts: string[]): string {
const pathParts = arrays.flatten(slashPathParts.map(part => part.split('/'))); if (process.platform === 'win32' && slashPathParts.length && !slashPathParts[0].match(/^c:/i)) {
if (process.platform === 'win32') { slashPathParts.unshift('c:');
if (slashPathParts.length === 1 && slashPathParts[0].match(/^c:/)) {
return slashPathParts[0];
} else {
return paths.join('c:', ...pathParts);
}
} else {
return paths.join(...pathParts);
} }
return paths.join(...slashPathParts);
} }
function normalizeExpression(expression: IExpression): IExpression { function normalizeExpression(expression: IExpression): IExpression {