@zzzen/pyright-internal 1.2.0-dev.20231126 → 1.2.0-dev.20231210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/analyzerFileInfo.d.ts +4 -3
- package/dist/analyzer/analyzerFileInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +15 -14
- package/dist/analyzer/backgroundAnalysisProgram.js +38 -38
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +59 -52
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +4 -1
- package/dist/analyzer/checker.js +189 -42
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/circularDependency.d.ts +3 -2
- package/dist/analyzer/circularDependency.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.js +36 -36
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/commentUtils.js +7 -0
- package/dist/analyzer/commentUtils.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +14 -5
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructors.js +2 -1
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +58 -47
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +5 -3
- package/dist/analyzer/declaration.js +3 -2
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +3 -2
- package/dist/analyzer/declarationUtils.js +14 -12
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/enums.js +1 -1
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +29 -25
- package/dist/analyzer/importResolver.js +300 -301
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.d.ts +5 -4
- package/dist/analyzer/importResult.js.map +1 -1
- package/dist/analyzer/importStatementUtils.d.ts +5 -4
- package/dist/analyzer/importStatementUtils.js +23 -22
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +3 -3
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +16 -14
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeReport.d.ts +7 -6
- package/dist/analyzer/packageTypeReport.js +4 -4
- package/dist/analyzer/packageTypeReport.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +68 -64
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parentDirectoryCache.d.ts +7 -6
- package/dist/analyzer/parentDirectoryCache.js +9 -10
- package/dist/analyzer/parentDirectoryCache.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/parseTreeUtils.js +6 -3
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/patternMatching.js +79 -14
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +27 -26
- package/dist/analyzer/program.js +162 -156
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +3 -3
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +27 -13
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pyTypedUtils.d.ts +3 -2
- package/dist/analyzer/pyTypedUtils.js +4 -5
- package/dist/analyzer/pyTypedUtils.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.d.ts +7 -6
- package/dist/analyzer/pythonPathUtils.js +21 -23
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/service.d.ts +24 -23
- package/dist/analyzer/service.js +187 -183
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +4 -5
- package/dist/analyzer/sourceFile.js +68 -56
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceFileInfoUtils.js +3 -3
- package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +11 -10
- package/dist/analyzer/sourceMapper.js +59 -62
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/sourceMapperUtils.d.ts +2 -1
- package/dist/analyzer/sourceMapperUtils.js +2 -2
- package/dist/analyzer/sourceMapperUtils.js.map +1 -1
- package/dist/analyzer/tracePrinter.d.ts +3 -2
- package/dist/analyzer/tracePrinter.js +21 -23
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.d.ts +2 -1
- package/dist/analyzer/typeDocStringUtils.js +14 -17
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +298 -231
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +1 -1
- package/dist/analyzer/typeEvaluatorTypes.js +1 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +3 -3
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +2 -0
- package/dist/analyzer/typePrinter.js +48 -8
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.d.ts +2 -1
- package/dist/analyzer/typeStubWriter.js +2 -2
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +5 -3
- package/dist/analyzer/typeUtils.js +32 -17
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +2 -0
- package/dist/analyzer/typeVarContext.js +27 -0
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typedDicts.js +6 -36
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +8 -12
- package/dist/analyzer/types.js +13 -20
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysis.d.ts +1 -2
- package/dist/backgroundAnalysis.js +6 -4
- package/dist/backgroundAnalysis.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +22 -20
- package/dist/backgroundAnalysisBase.js +76 -55
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.d.ts +1 -1
- package/dist/backgroundThreadBase.js +20 -11
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/commandController.js +1 -2
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/commands.d.ts +0 -1
- package/dist/commands/commands.js +0 -1
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/createTypeStub.js +3 -2
- package/dist/commands/createTypeStub.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +21 -20
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/commands/quickActionCommand.js +5 -5
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/common/configOptions.d.ts +15 -13
- package/dist/common/configOptions.js +120 -30
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/diagnostic.d.ts +6 -9
- package/dist/common/diagnostic.js +2 -2
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticSink.d.ts +2 -1
- package/dist/common/diagnosticSink.js.map +1 -1
- package/dist/common/editAction.d.ts +6 -5
- package/dist/common/editAction.js +2 -2
- package/dist/common/editAction.js.map +1 -1
- package/dist/common/envVarUtils.d.ts +2 -1
- package/dist/common/envVarUtils.js +20 -28
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +19 -19
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/fileSystem.d.ts +29 -28
- package/dist/common/fileWatcher.d.ts +3 -2
- package/dist/common/fileWatcher.js.map +1 -1
- package/dist/common/fullAccessHost.d.ts +8 -7
- package/dist/common/fullAccessHost.js +21 -16
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/host.d.ts +7 -6
- package/dist/common/host.js +1 -1
- package/dist/common/host.js.map +1 -1
- package/dist/common/logTracker.d.ts +2 -1
- package/dist/common/logTracker.js +4 -4
- package/dist/common/logTracker.js.map +1 -1
- package/dist/common/pathUtils.d.ts +1 -28
- package/dist/common/pathUtils.js +17 -366
- package/dist/common/pathUtils.js.map +1 -1
- package/dist/common/realFileSystem.d.ts +7 -3
- package/dist/common/realFileSystem.js +78 -60
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/serviceProviderExtensions.d.ts +2 -1
- package/dist/common/serviceProviderExtensions.js +5 -2
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/textEditTracker.d.ts +2 -1
- package/dist/common/textEditTracker.js +28 -28
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/textRange.d.ts +2 -1
- package/dist/common/textRange.js.map +1 -1
- package/dist/common/uri/baseUri.d.ts +51 -0
- package/dist/common/uri/baseUri.js +194 -0
- package/dist/common/uri/baseUri.js.map +1 -0
- package/dist/common/uri/emptyUri.d.ts +32 -0
- package/dist/common/uri/emptyUri.js +122 -0
- package/dist/common/uri/emptyUri.js.map +1 -0
- package/dist/common/uri/fileUri.d.ts +36 -0
- package/dist/common/uri/fileUri.js +180 -0
- package/dist/common/uri/fileUri.js.map +1 -0
- package/dist/common/uri/memoization.d.ts +3 -0
- package/dist/common/uri/memoization.js +72 -0
- package/dist/common/uri/memoization.js.map +1 -0
- package/dist/common/uri/uri.d.ts +50 -0
- package/dist/common/uri/uri.js +104 -0
- package/dist/common/uri/uri.js.map +1 -0
- package/dist/common/uri/uriUtils.d.ts +39 -0
- package/dist/common/uri/uriUtils.js +362 -0
- package/dist/common/uri/uriUtils.js.map +1 -0
- package/dist/common/uri/webUri.d.ts +36 -0
- package/dist/common/uri/webUri.js +207 -0
- package/dist/common/uri/webUri.js.map +1 -0
- package/dist/common/workspaceEditUtils.d.ts +8 -8
- package/dist/common/workspaceEditUtils.js +34 -37
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +19 -22
- package/dist/languageServerBase.js +91 -95
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.d.ts +2 -1
- package/dist/languageService/analyzerServiceExecutor.js +14 -16
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +11 -9
- package/dist/languageService/autoImporter.js +45 -44
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.d.ts +3 -2
- package/dist/languageService/callHierarchyProvider.js +23 -35
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.d.ts +2 -1
- package/dist/languageService/codeActionProvider.js +8 -24
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +7 -6
- package/dist/languageService/completionProvider.js +32 -30
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +2 -1
- package/dist/languageService/completionProviderUtils.js +1 -1
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +4 -3
- package/dist/languageService/definitionProvider.js +26 -24
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentHighlightProvider.d.ts +3 -2
- package/dist/languageService/documentHighlightProvider.js +3 -3
- package/dist/languageService/documentHighlightProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js +8 -7
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.d.ts +5 -4
- package/dist/languageService/documentSymbolProvider.js +9 -11
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +4 -3
- package/dist/languageService/hoverProvider.js +6 -5
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/navigationUtils.d.ts +2 -1
- package/dist/languageService/navigationUtils.js +2 -3
- package/dist/languageService/navigationUtils.js.map +1 -1
- package/dist/languageService/quickActions.d.ts +2 -2
- package/dist/languageService/quickActions.js +3 -83
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/referencesProvider.d.ts +10 -9
- package/dist/languageService/referencesProvider.js +28 -28
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/renameProvider.d.ts +4 -3
- package/dist/languageService/renameProvider.js +17 -18
- package/dist/languageService/renameProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.d.ts +3 -2
- package/dist/languageService/signatureHelpProvider.js +4 -4
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.d.ts +2 -1
- package/dist/languageService/symbolIndexer.js +1 -1
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +10 -4
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.d.ts +4 -3
- package/dist/languageService/workspaceSymbolProvider.js +10 -11
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +13 -9
- package/dist/localization/localize.js +7 -4
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +0 -4
- package/dist/localization/package.nls.de.json +0 -4
- package/dist/localization/package.nls.en-us.json +9 -6
- package/dist/localization/package.nls.es.json +2 -6
- package/dist/localization/package.nls.fr.json +0 -4
- package/dist/localization/package.nls.it.json +0 -4
- package/dist/localization/package.nls.ja.json +0 -4
- package/dist/localization/package.nls.ko.json +0 -4
- package/dist/localization/package.nls.pl.json +0 -4
- package/dist/localization/package.nls.pt-br.json +0 -4
- package/dist/localization/package.nls.qps-ploc.json +0 -4
- package/dist/localization/package.nls.ru.json +0 -4
- package/dist/localization/package.nls.tr.json +0 -4
- package/dist/localization/package.nls.zh-cn.json +0 -4
- package/dist/localization/package.nls.zh-tw.json +0 -4
- package/dist/pyright.js +18 -17
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +13 -13
- package/dist/pyrightFileSystem.js +39 -44
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +29 -28
- package/dist/readonlyAugmentedFileSystem.js +68 -61
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.js +22 -21
- package/dist/server.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +39 -30
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +38 -29
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/completions.test.js +7 -3
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/config.test.js +24 -22
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/documentSymbolCollector.test.js +3 -2
- package/dist/tests/documentSymbolCollector.test.js.map +1 -1
- package/dist/tests/filesystem.test.js +37 -35
- package/dist/tests/filesystem.test.js.map +1 -1
- package/dist/tests/fourSlashParser.test.js +4 -4
- package/dist/tests/fourSlashParser.test.js.map +1 -1
- package/dist/tests/fourslash/fourslash.d.ts +1 -2
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js +27 -11
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js +2 -2
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.d.ts +4 -5
- package/dist/tests/harness/fourslash/testLanguageService.js +9 -15
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.Consts.d.ts +1 -2
- package/dist/tests/harness/fourslash/testState.Consts.js +0 -1
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +4 -4
- package/dist/tests/harness/fourslash/testState.js +92 -52
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/testAccessHost.d.ts +3 -2
- package/dist/tests/harness/testAccessHost.js +2 -1
- package/dist/tests/harness/testAccessHost.js.map +1 -1
- package/dist/tests/harness/testHost.js +13 -11
- package/dist/tests/harness/testHost.js.map +1 -1
- package/dist/tests/harness/vfs/factory.d.ts +3 -2
- package/dist/tests/harness/vfs/factory.js +5 -4
- package/dist/tests/harness/vfs/factory.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.d.ts +32 -31
- package/dist/tests/harness/vfs/filesystem.js +47 -49
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/harness/vfs/pathValidation.js +1 -10
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
- package/dist/tests/importResolver.test.js +81 -58
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js +10 -9
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/ipythonMode.test.js +12 -11
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/logger.test.js +2 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +2 -1
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/pathUtils.test.js +3 -138
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/pyrightFileSystem.test.js +76 -25
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/service.test.js +37 -42
- package/dist/tests/service.test.js.map +1 -1
- package/dist/tests/signatureHelp.test.js +3 -2
- package/dist/tests/signatureHelp.test.js.map +1 -1
- package/dist/tests/sourceFile.test.js +8 -7
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +13 -6
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/testState.test.js +13 -9
- package/dist/tests/testState.test.js.map +1 -1
- package/dist/tests/testStateUtils.d.ts +2 -5
- package/dist/tests/testStateUtils.js +27 -64
- package/dist/tests/testStateUtils.js.map +1 -1
- package/dist/tests/testUtils.d.ts +3 -5
- package/dist/tests/testUtils.js +15 -64
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/textEditUtil.test.js +4 -3
- package/dist/tests/textEditUtil.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +23 -19
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +21 -12
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +84 -70
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +26 -21
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +36 -31
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js +4 -3
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/tests/uri.test.d.ts +1 -0
- package/dist/tests/uri.test.js +695 -0
- package/dist/tests/uri.test.js.map +1 -0
- package/dist/tests/workspaceEditUtils.test.js +28 -28
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/tests/zipfs.test.js +11 -11
- package/dist/tests/zipfs.test.js.map +1 -1
- package/dist/workspaceFactory.d.ts +13 -14
- package/dist/workspaceFactory.js +54 -55
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +2 -2
- package/dist/common/uriParser.d.ts +0 -24
- package/dist/common/uriParser.js +0 -45
- package/dist/common/uriParser.js.map +0 -1
@@ -0,0 +1,695 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* pathUtils.test.ts
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
5
|
+
* Licensed under the MIT license.
|
6
|
+
* Author: Eric Traut
|
7
|
+
*
|
8
|
+
* Unit tests for pathUtils module.
|
9
|
+
*/
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
11
|
+
if (k2 === undefined) k2 = k;
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
15
|
+
}
|
16
|
+
Object.defineProperty(o, k2, desc);
|
17
|
+
}) : (function(o, m, k, k2) {
|
18
|
+
if (k2 === undefined) k2 = k;
|
19
|
+
o[k2] = m[k];
|
20
|
+
}));
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
23
|
+
}) : function(o, v) {
|
24
|
+
o["default"] = v;
|
25
|
+
});
|
26
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
27
|
+
if (mod && mod.__esModule) return mod;
|
28
|
+
var result = {};
|
29
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
30
|
+
__setModuleDefault(result, mod);
|
31
|
+
return result;
|
32
|
+
};
|
33
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
34
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
35
|
+
};
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
37
|
+
const assert_1 = __importDefault(require("assert"));
|
38
|
+
const nodefs = __importStar(require("fs-extra"));
|
39
|
+
const os = __importStar(require("os"));
|
40
|
+
const path = __importStar(require("path"));
|
41
|
+
const envVarUtils_1 = require("../common/envVarUtils");
|
42
|
+
const pathUtils_1 = require("../common/pathUtils");
|
43
|
+
const realFileSystem_1 = require("../common/realFileSystem");
|
44
|
+
const uri_1 = require("../common/uri/uri");
|
45
|
+
const uriUtils_1 = require("../common/uri/uriUtils");
|
46
|
+
const vfs = __importStar(require("./harness/vfs/filesystem"));
|
47
|
+
test('parse', () => {
|
48
|
+
assert_1.default.throws(() => uri_1.Uri.parse('\\c:\\foo : bar', true));
|
49
|
+
assert_1.default.throws(() => uri_1.Uri.parse('foo:////server/b/c', true)); // No authority component
|
50
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:///a/b/c', true));
|
51
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:a/b/c', true));
|
52
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:/a/b/c', true));
|
53
|
+
assert_1.default.ok(uri_1.Uri.parse('foo://server/share/dir/file.py', true));
|
54
|
+
assert_1.default.ok(uri_1.Uri.parse('foo://server/share/dir/file.py?query#fragment', true));
|
55
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:///c:/users/me', true));
|
56
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:///c%3A%52users%52me', true));
|
57
|
+
assert_1.default.ok(uri_1.Uri.parse('', true));
|
58
|
+
assert_1.default.ok(uri_1.Uri.parse(undefined, true));
|
59
|
+
});
|
60
|
+
test('file', () => {
|
61
|
+
const cwd = process.cwd();
|
62
|
+
const uri1 = uri_1.Uri.file('a/b/c', true, true);
|
63
|
+
assert_1.default.ok(uri1.getFilePath().length > 6);
|
64
|
+
assert_1.default.ok(uri1.getFilePath().toLowerCase().startsWith(cwd.toLowerCase()), `${uri1.getFilePath()} does not start with ${cwd}`);
|
65
|
+
const uri2 = uri_1.Uri.file('a/b/c', true, false);
|
66
|
+
assert_1.default.equal(uri2.getFilePath().length, 6);
|
67
|
+
});
|
68
|
+
test('key', () => {
|
69
|
+
const key = uri_1.Uri.parse('foo:///a/b/c', true).key;
|
70
|
+
const key2 = uri_1.Uri.parse('foo:///a/b/c', true).key;
|
71
|
+
assert_1.default.equal(key, key2);
|
72
|
+
const key3 = uri_1.Uri.parse('foo:///a/b/d', true).key;
|
73
|
+
assert_1.default.notEqual(key, key3);
|
74
|
+
const key4 = uri_1.Uri.file('/a/b/c').key;
|
75
|
+
assert_1.default.notEqual(key, key4);
|
76
|
+
const key5 = uri_1.Uri.parse('file:///a/b/c', true).key;
|
77
|
+
assert_1.default.equal(key4, key5);
|
78
|
+
const key6 = uri_1.Uri.file((0, pathUtils_1.normalizeSlashes)('c:\\foo\\bar\\d.txt')).key;
|
79
|
+
const key7 = uri_1.Uri.parse('file:///c%3A/foo/bar/d.txt', true).key;
|
80
|
+
const key8 = uri_1.Uri.parse('file:///c:/foo/bar/d.txt', true).key;
|
81
|
+
assert_1.default.equal(key6, key7);
|
82
|
+
assert_1.default.equal(key6, key8);
|
83
|
+
const key9 = uri_1.Uri.parse('file:///c%3A/foo/bar/D.txt', true).key;
|
84
|
+
const key10 = uri_1.Uri.parse('file:///c:/foo/bar/d.txt', true).key;
|
85
|
+
assert_1.default.notEqual(key9, key10);
|
86
|
+
const key11 = uri_1.Uri.parse('file:///c%3A/foo/bar/D.txt', false).key;
|
87
|
+
const key12 = uri_1.Uri.parse('file:///c%3A/foo/bar/d.txt', false).key;
|
88
|
+
assert_1.default.equal(key11, key12);
|
89
|
+
});
|
90
|
+
test('filename', () => {
|
91
|
+
const filename = uri_1.Uri.parse('foo:///a/b/c', true).fileName;
|
92
|
+
assert_1.default.equal(filename, 'c');
|
93
|
+
const filename2 = uri_1.Uri.parse('foo:///a/b/c/', true).fileName;
|
94
|
+
assert_1.default.equal(filename2, 'c');
|
95
|
+
const filename3 = uri_1.Uri.parse('foo:///a/b/c.py', true).fileName;
|
96
|
+
assert_1.default.equal(filename3, 'c.py');
|
97
|
+
const filename4 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment', true).fileName;
|
98
|
+
assert_1.default.equal(filename4, 'c.py');
|
99
|
+
const filename5 = uri_1.Uri.file('/a/b/c').fileName;
|
100
|
+
assert_1.default.equal(filename5, 'c');
|
101
|
+
const filename6 = uri_1.Uri.parse('file:///a/b/c', true).fileName;
|
102
|
+
assert_1.default.equal(filename6, 'c');
|
103
|
+
});
|
104
|
+
test('extname', () => {
|
105
|
+
const extname = uri_1.Uri.parse('foo:///a/b/c', true).lastExtension;
|
106
|
+
assert_1.default.equal(extname, '');
|
107
|
+
const extname2 = uri_1.Uri.parse('foo:///a/b/c/', true).lastExtension;
|
108
|
+
assert_1.default.equal(extname2, '');
|
109
|
+
const extname3 = uri_1.Uri.parse('foo:///a/b/c.py', true).lastExtension;
|
110
|
+
assert_1.default.equal(extname3, '.py');
|
111
|
+
const extname4 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment', true).lastExtension;
|
112
|
+
assert_1.default.equal(extname4, '.py');
|
113
|
+
const extname5 = uri_1.Uri.file('/a/b/c.py.foo').lastExtension;
|
114
|
+
assert_1.default.equal(extname5, '.foo');
|
115
|
+
const extname6 = uri_1.Uri.parse('file:///a/b/c.py.foo', true).lastExtension;
|
116
|
+
assert_1.default.equal(extname6, '.foo');
|
117
|
+
});
|
118
|
+
test('root', () => {
|
119
|
+
const root1 = uri_1.Uri.parse('foo://authority/a/b/c', true).root;
|
120
|
+
assert_1.default.equal(root1.toString(), 'foo://authority/');
|
121
|
+
const root = uri_1.Uri.parse('file://server/b/c', true).root;
|
122
|
+
assert_1.default.equal(root.toString(), 'file://server/');
|
123
|
+
assert_1.default.equal(root.getRootPathLength(), 9);
|
124
|
+
const root2 = uri_1.Uri.parse('foo:///', true).root;
|
125
|
+
assert_1.default.equal(root2.toString(), 'foo:///');
|
126
|
+
const root3 = uri_1.Uri.parse('foo:///a/b/c/', true).root;
|
127
|
+
assert_1.default.equal(root3.toString(), 'foo:///');
|
128
|
+
assert_1.default.ok(root3.isRoot());
|
129
|
+
const root4 = uri_1.Uri.parse('foo:///a/b/c.py', true).root;
|
130
|
+
assert_1.default.equal(root4.toString(), 'foo:///');
|
131
|
+
const root5 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment', true).root;
|
132
|
+
assert_1.default.equal(root5.toString(), 'foo:///');
|
133
|
+
const root6 = uri_1.Uri.file('/a/b/c.py.foo').root;
|
134
|
+
assert_1.default.equal(root6.toString(), 'file:///');
|
135
|
+
const root7 = uri_1.Uri.parse('file:///a/b/c.py.foo', true).root;
|
136
|
+
assert_1.default.equal(root7.toString(), 'file:///');
|
137
|
+
assert_1.default.equal(root7.getRootPathLength(), 1);
|
138
|
+
const root8 = uri_1.Uri.parse('untitled:Untitled-1', true).root;
|
139
|
+
assert_1.default.equal(root8.toString(), 'untitled://');
|
140
|
+
assert_1.default.equal(root8.getRootPathLength(), 0);
|
141
|
+
assert_1.default.equal(root8.isRoot(), false);
|
142
|
+
const root9 = uri_1.Uri.parse('file://a/b/c/d.py', true).root;
|
143
|
+
assert_1.default.equal(root9.toString(), 'file://a/');
|
144
|
+
assert_1.default.equal(root9.getRootPathLength(), 4);
|
145
|
+
assert_1.default.ok(root9.isRoot());
|
146
|
+
const root10 = uri_1.Uri.parse('file://c%3A/b/c/d.py', true).root;
|
147
|
+
assert_1.default.equal(root10.toString(), 'file://c:/');
|
148
|
+
assert_1.default.equal(root10.getRootPathLength(), 5);
|
149
|
+
assert_1.default.ok(root10.isRoot());
|
150
|
+
});
|
151
|
+
test('empty', () => {
|
152
|
+
const empty = uri_1.Uri.parse('', true);
|
153
|
+
assert_1.default.equal(empty.isEmpty(), true);
|
154
|
+
const empty2 = uri_1.Uri.parse('foo:///', true).isEmpty();
|
155
|
+
assert_1.default.equal(empty2, false);
|
156
|
+
const empty3 = uri_1.Uri.empty();
|
157
|
+
assert_1.default.equal(empty3.isEmpty(), true);
|
158
|
+
const empty4 = uri_1.Uri.parse(undefined, true);
|
159
|
+
assert_1.default.equal(empty4.isEmpty(), true);
|
160
|
+
assert_1.default.ok(empty4.equals(empty3));
|
161
|
+
assert_1.default.ok(empty3.equals(empty));
|
162
|
+
});
|
163
|
+
test('file', () => {
|
164
|
+
const file1 = uri_1.Uri.file((0, pathUtils_1.normalizeSlashes)('/a/b/c')).getFilePath();
|
165
|
+
assert_1.default.equal(file1, (0, pathUtils_1.normalizeSlashes)('/a/b/c'));
|
166
|
+
const file2 = uri_1.Uri.file('file:///a/b/c').getFilePath();
|
167
|
+
assert_1.default.equal(file2, (0, pathUtils_1.normalizeSlashes)('/a/b/c'));
|
168
|
+
});
|
169
|
+
test('isUri', () => {
|
170
|
+
const isUri = uri_1.Uri.isUri('foo:///a/b/c');
|
171
|
+
assert_1.default.equal(isUri, false);
|
172
|
+
const isUri2 = uri_1.Uri.isUri('/a/b/c');
|
173
|
+
assert_1.default.equal(isUri2, false);
|
174
|
+
const isUri3 = uri_1.Uri.isUri(undefined);
|
175
|
+
assert_1.default.equal(isUri3, false);
|
176
|
+
const isUri4 = uri_1.Uri.isUri(uri_1.Uri.parse('foo:///a/b/c', true));
|
177
|
+
assert_1.default.equal(isUri4, true);
|
178
|
+
const isUri5 = uri_1.Uri.isUri(uri_1.Uri.empty());
|
179
|
+
assert_1.default.equal(isUri5, true);
|
180
|
+
});
|
181
|
+
test('matchesRegex', () => {
|
182
|
+
const includeFiles = /\.pyi?$/;
|
183
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi', true);
|
184
|
+
assert_1.default.ok(uri.matchesRegex(includeFiles));
|
185
|
+
const uri2 = uri_1.Uri.parse('file:///a/b/c.px', true);
|
186
|
+
assert_1.default.equal(uri2.matchesRegex(includeFiles), false);
|
187
|
+
const uri3 = uri_1.Uri.parse('vscode-vfs:///a/b/c.pyi', true);
|
188
|
+
assert_1.default.ok(uri3.matchesRegex(includeFiles));
|
189
|
+
const fileRegex = /^(c:\/foo\/bar)($|\/)/i;
|
190
|
+
const uri4 = uri_1.Uri.parse('file:///C%3A/foo/bar', true);
|
191
|
+
assert_1.default.ok(uri4.matchesRegex(fileRegex));
|
192
|
+
const uri5 = uri_1.Uri.parse('file:///c%3A/foo/bar', true);
|
193
|
+
assert_1.default.ok(uri5.matchesRegex(fileRegex));
|
194
|
+
const uri6 = uri_1.Uri.parse('file:///c:/foo/bar', true);
|
195
|
+
assert_1.default.ok(uri6.matchesRegex(fileRegex));
|
196
|
+
const uri7 = uri_1.Uri.parse('file:///c:/foo/bar/', true);
|
197
|
+
assert_1.default.ok(uri7.matchesRegex(fileRegex));
|
198
|
+
const uri8 = uri_1.Uri.parse('file:///c:/foo/baz/', true);
|
199
|
+
assert_1.default.equal(uri8.matchesRegex(fileRegex), false);
|
200
|
+
});
|
201
|
+
test('replaceExtension', () => {
|
202
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi', true);
|
203
|
+
const uri2 = uri.replaceExtension('.py');
|
204
|
+
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.py');
|
205
|
+
const uri3 = uri_1.Uri.parse('file:///a/b/c', true);
|
206
|
+
const uri4 = uri3.replaceExtension('.py');
|
207
|
+
assert_1.default.equal(uri4.toString(), 'file:///a/b/c.py');
|
208
|
+
const uri5 = uri_1.Uri.parse('file:///a/b/c.foo.py', true);
|
209
|
+
const uri6 = uri5.replaceExtension('.pyi');
|
210
|
+
assert_1.default.equal(uri6.toString(), 'file:///a/b/c.foo.pyi');
|
211
|
+
});
|
212
|
+
test('addExtension', () => {
|
213
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
214
|
+
const uri2 = uri.addExtension('.py');
|
215
|
+
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyi.py');
|
216
|
+
const uri3 = uri_1.Uri.parse('file:///a/b/c', true);
|
217
|
+
const uri4 = uri3.addExtension('.py');
|
218
|
+
assert_1.default.equal(uri4.toString(), 'file:///a/b/c.py');
|
219
|
+
});
|
220
|
+
test('addPath', () => {
|
221
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
222
|
+
const uri2 = uri.addPath('d');
|
223
|
+
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyid');
|
224
|
+
});
|
225
|
+
test('directory', () => {
|
226
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
227
|
+
const uri2 = uri.getDirectory();
|
228
|
+
assert_1.default.equal(uri2.toString(), 'file:///a/b');
|
229
|
+
const uri3 = uri2.getDirectory();
|
230
|
+
assert_1.default.equal(uri3.toString(), 'file:///a');
|
231
|
+
const uri4 = uri_1.Uri.parse('file:///a/b/', true);
|
232
|
+
const uri5 = uri4.getDirectory();
|
233
|
+
assert_1.default.equal(uri5.toString(), 'file:///a');
|
234
|
+
const uri6 = uri4.getDirectory();
|
235
|
+
assert_1.default.ok(uri6.equals(uri5));
|
236
|
+
});
|
237
|
+
test('init and pytyped', () => {
|
238
|
+
const uri = uri_1.Uri.parse('file:///a/b/c?query#fragment', true);
|
239
|
+
const uri2 = uri.pytypedUri;
|
240
|
+
assert_1.default.equal(uri2.toString(), 'file:///a/b/c/py.typed');
|
241
|
+
const uri3 = uri.initPyUri;
|
242
|
+
assert_1.default.equal(uri3.toString(), 'file:///a/b/c/__init__.py');
|
243
|
+
const uri4 = uri.initPyiUri;
|
244
|
+
assert_1.default.equal(uri4.toString(), 'file:///a/b/c/__init__.pyi');
|
245
|
+
const uri5 = uri.packageUri;
|
246
|
+
assert_1.default.equal(uri5.toString(), 'file:///a/b/c.py');
|
247
|
+
const uri6 = uri.packageStubUri;
|
248
|
+
assert_1.default.equal(uri6.toString(), 'file:///a/b/c.pyi');
|
249
|
+
const uri7 = uri_1.Uri.parse('foo://microsoft.com/a/b/c.py', true);
|
250
|
+
const uri8 = uri7.pytypedUri;
|
251
|
+
assert_1.default.equal(uri8.toString(), 'foo://microsoft.com/a/b/c.py/py.typed');
|
252
|
+
const uri9 = uri7.initPyUri;
|
253
|
+
assert_1.default.equal(uri9.toString(), 'foo://microsoft.com/a/b/c.py/__init__.py');
|
254
|
+
const uri10 = uri7.initPyiUri;
|
255
|
+
assert_1.default.equal(uri10.toString(), 'foo://microsoft.com/a/b/c.py/__init__.pyi');
|
256
|
+
const uri11 = uri7.packageUri;
|
257
|
+
assert_1.default.equal(uri11.toString(), 'foo://microsoft.com/a/b/c.py.py');
|
258
|
+
const uri12 = uri7.packageStubUri;
|
259
|
+
assert_1.default.equal(uri12.toString(), 'foo://microsoft.com/a/b/c.py.pyi');
|
260
|
+
});
|
261
|
+
test('isChild', () => {
|
262
|
+
const parent = uri_1.Uri.parse('file:///a/b/?query#fragment', true);
|
263
|
+
const child = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
264
|
+
assert_1.default.ok(child.isChild(parent));
|
265
|
+
const parent2 = uri_1.Uri.parse('file:///a/b', true);
|
266
|
+
const child2 = uri_1.Uri.parse('file:///a/b/c.pyi', true);
|
267
|
+
const child2DifferentCase = uri_1.Uri.parse('file:///a/B/C.pyi', false);
|
268
|
+
assert_1.default.ok(child2.isChild(parent2));
|
269
|
+
assert_1.default.ok(child2DifferentCase.isChild(parent2));
|
270
|
+
const parent3 = uri_1.Uri.parse('file:///a/b/', true);
|
271
|
+
const child3 = uri_1.Uri.parse('file:///a/b/c.pyi', true);
|
272
|
+
assert_1.default.ok(child3.isChild(parent3));
|
273
|
+
const parent4 = uri_1.Uri.parse('file:///a/b/', true);
|
274
|
+
const notChild4 = uri_1.Uri.parse('file:///a/bb/c.pyi', true);
|
275
|
+
assert_1.default.ok(!notChild4.isChild(parent4));
|
276
|
+
assert_1.default.ok(!notChild4.isChild(parent2));
|
277
|
+
const notChild5 = uri_1.Uri.parse('file:///a/b/', true);
|
278
|
+
assert_1.default.ok(!notChild5.isChild(parent4));
|
279
|
+
});
|
280
|
+
test('equals', () => {
|
281
|
+
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
282
|
+
const uri2 = uri_1.Uri.file('/a/b/c.pyi');
|
283
|
+
assert_1.default.ok(!uri1.equals(uri2));
|
284
|
+
const uri3 = uri1.stripExtension().addExtension('.pyi');
|
285
|
+
assert_1.default.ok(uri2.equals(uri3));
|
286
|
+
const uri4 = uri_1.Uri.parse('foo:///a/b/c', true);
|
287
|
+
const uri5 = uri_1.Uri.parse('foo:///a/b/c', true);
|
288
|
+
const uri6 = uri_1.Uri.parse('foo:///a/b/c/', true);
|
289
|
+
assert_1.default.ok(uri4.equals(uri5));
|
290
|
+
assert_1.default.ok(uri4.equals(uri6));
|
291
|
+
const uri7 = uri_1.Uri.parse('file://c%3A/b/c/d.py', true).root;
|
292
|
+
const uri8 = uri_1.Uri.parse('file://c:/', true);
|
293
|
+
assert_1.default.ok(uri7.equals(uri8));
|
294
|
+
const uri9 = uri_1.Uri.parse('foo:///a/b/c?query', true);
|
295
|
+
assert_1.default.ok(!uri9.equals(uri4));
|
296
|
+
// Web uris are always case sensitive
|
297
|
+
const uri10 = uri_1.Uri.parse('foo:///a/b/c', false);
|
298
|
+
const uri11 = uri_1.Uri.parse('foo:///a/B/c', false);
|
299
|
+
assert_1.default.ok(!uri10.equals(uri11));
|
300
|
+
// Filre uris pay attention to the parameter.
|
301
|
+
const uri12 = uri_1.Uri.parse('file:///a/b/c', false);
|
302
|
+
const uri13 = uri_1.Uri.parse('file:///a/B/c', false);
|
303
|
+
assert_1.default.ok(uri12.equals(uri13));
|
304
|
+
const uri14 = uri_1.Uri.parse('file:///a/b/c', true);
|
305
|
+
const uri15 = uri_1.Uri.parse('file:///a/B/c', true);
|
306
|
+
assert_1.default.ok(!uri14.equals(uri15));
|
307
|
+
});
|
308
|
+
test('startsWith', () => {
|
309
|
+
const parent = uri_1.Uri.parse('file:///a/b/?query#fragment', true);
|
310
|
+
const child = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
311
|
+
assert_1.default.ok(child.startsWith(parent));
|
312
|
+
const parent2 = uri_1.Uri.parse('file:///a/b', true);
|
313
|
+
const child2 = uri_1.Uri.parse('file:///a/b/c.pyi', true);
|
314
|
+
assert_1.default.ok(child2.startsWith(parent2));
|
315
|
+
const parent3 = uri_1.Uri.parse('file:///a/b/', true);
|
316
|
+
const child3 = uri_1.Uri.parse('file:///a/b/c.pyi', true);
|
317
|
+
assert_1.default.ok(child3.startsWith(parent3));
|
318
|
+
const parent4 = uri_1.Uri.parse('file:///a/b/', true);
|
319
|
+
const notChild4 = uri_1.Uri.parse('file:///a/bb/c.pyi', true);
|
320
|
+
assert_1.default.ok(!notChild4.startsWith(parent4));
|
321
|
+
assert_1.default.ok(!notChild4.startsWith(parent2));
|
322
|
+
});
|
323
|
+
test('path comparisons', () => {
|
324
|
+
const uri = uri_1.Uri.parse('foo:///a/b/c.pyi?query#fragment', true);
|
325
|
+
assert_1.default.ok(uri.pathEndsWith('c.pyi'));
|
326
|
+
assert_1.default.ok(uri.pathEndsWith('b/c.pyi'));
|
327
|
+
assert_1.default.ok(uri.pathEndsWith('a/b/c.pyi'));
|
328
|
+
assert_1.default.ok(!uri.pathEndsWith('a/b/c.py'));
|
329
|
+
assert_1.default.ok(!uri.pathEndsWith('b/c.py'));
|
330
|
+
assert_1.default.ok(uri.pathIncludes('c.pyi'));
|
331
|
+
assert_1.default.ok(uri.pathIncludes('b/c'));
|
332
|
+
assert_1.default.ok(uri.pathIncludes('a/b/c'));
|
333
|
+
const uri2 = uri_1.Uri.parse('file:///C%3A/a/b/c.pyi?query#fragment', true);
|
334
|
+
assert_1.default.ok(uri2.pathEndsWith('c.pyi'));
|
335
|
+
assert_1.default.ok(uri2.pathEndsWith('b/c.pyi'));
|
336
|
+
assert_1.default.ok(!uri2.pathStartsWith('C:/a'));
|
337
|
+
assert_1.default.ok(!uri2.pathStartsWith('C:/a/b'));
|
338
|
+
assert_1.default.ok(uri2.pathStartsWith('c:/a'));
|
339
|
+
assert_1.default.ok(uri2.pathStartsWith('c:/a/b'));
|
340
|
+
});
|
341
|
+
test('combinePaths', () => {
|
342
|
+
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', true);
|
343
|
+
const uri2 = uri1.combinePaths('d', 'e');
|
344
|
+
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyi/d/e');
|
345
|
+
const uri3 = uri1.combinePaths('d', 'e/');
|
346
|
+
assert_1.default.equal(uri3.toString(), 'file:///a/b/c.pyi/d/e');
|
347
|
+
const uri4 = uri1.combinePaths('d', 'e', 'f/');
|
348
|
+
assert_1.default.equal(uri4.toString(), 'file:///a/b/c.pyi/d/e/f');
|
349
|
+
const uri5 = uri1.combinePaths('d', '..', 'e');
|
350
|
+
assert_1.default.equal(uri5.toString(), 'file:///a/b/c.pyi/e');
|
351
|
+
const rootedPath = process.platform === 'win32' ? 'D:' : '/D';
|
352
|
+
const rootedResult = process.platform === 'win32' ? 'file:///d%3A/e/f' : 'file:///D/e/f';
|
353
|
+
const uri6 = uri1.combinePaths(rootedPath, 'e', 'f');
|
354
|
+
assert_1.default.equal(uri6.toString(), rootedResult);
|
355
|
+
const uri7 = uri_1.Uri.parse('foo:', true);
|
356
|
+
const uri8 = uri7.combinePaths('d', 'e');
|
357
|
+
assert_1.default.equal(uri8.toString(), 'foo://d/e');
|
358
|
+
const uri9 = uri_1.Uri.parse('foo:/', true);
|
359
|
+
const uri10 = uri9.combinePaths('d', 'e');
|
360
|
+
assert_1.default.equal(uri10.toString(), 'foo:///d/e');
|
361
|
+
const uri11 = uri_1.Uri.empty().combinePaths('d', 'e');
|
362
|
+
assert_1.default.equal(uri11.toString(), uri_1.Uri.empty().toString());
|
363
|
+
});
|
364
|
+
test('combinePaths non file', () => {
|
365
|
+
const uri1 = uri_1.Uri.parse('baz://authority/a/b/c.pyi?query#fragment', true);
|
366
|
+
const uri2 = uri1.combinePaths('d', 'e');
|
367
|
+
assert_1.default.equal(uri2.toString(), 'baz://authority/a/b/c.pyi/d/e');
|
368
|
+
const uri3 = uri1.combinePaths('d', 'e/');
|
369
|
+
assert_1.default.equal(uri3.toString(), 'baz://authority/a/b/c.pyi/d/e');
|
370
|
+
const uri4 = uri1.combinePaths('d', 'e', 'f/');
|
371
|
+
assert_1.default.equal(uri4.toString(), 'baz://authority/a/b/c.pyi/d/e/f');
|
372
|
+
const uri5 = uri1.combinePaths('d', '..', 'e');
|
373
|
+
assert_1.default.equal(uri5.toString(), 'baz://authority/a/b/c.pyi/e');
|
374
|
+
});
|
375
|
+
test('getPathComponents1', () => {
|
376
|
+
const components = uri_1.Uri.parse('', true).getPathComponents();
|
377
|
+
assert_1.default.equal(components.length, 0);
|
378
|
+
});
|
379
|
+
test('getPathComponents2', () => {
|
380
|
+
const components = uri_1.Uri.parse('/users/', true).getPathComponents();
|
381
|
+
assert_1.default.equal(components.length, 2);
|
382
|
+
assert_1.default.equal(components[0], '/');
|
383
|
+
assert_1.default.equal(components[1], 'users');
|
384
|
+
});
|
385
|
+
test('getPathComponents3', () => {
|
386
|
+
const components = uri_1.Uri.parse('/users/hello.py', true).getPathComponents();
|
387
|
+
assert_1.default.equal(components.length, 3);
|
388
|
+
assert_1.default.equal(components[0], '/');
|
389
|
+
assert_1.default.equal(components[1], 'users');
|
390
|
+
assert_1.default.equal(components[2], 'hello.py');
|
391
|
+
});
|
392
|
+
test('getPathComponents4', () => {
|
393
|
+
const components = uri_1.Uri.parse('/users/hello/../', true).getPathComponents();
|
394
|
+
assert_1.default.equal(components.length, 2);
|
395
|
+
assert_1.default.equal(components[0], '/');
|
396
|
+
assert_1.default.equal(components[1], 'users');
|
397
|
+
});
|
398
|
+
test('getPathComponents5', () => {
|
399
|
+
const components = uri_1.Uri.parse('./hello.py', true).getPathComponents();
|
400
|
+
assert_1.default.equal(components.length, 2);
|
401
|
+
assert_1.default.equal(components[0], '/');
|
402
|
+
assert_1.default.equal(components[1], 'hello.py');
|
403
|
+
});
|
404
|
+
test('getPathComponents6', () => {
|
405
|
+
const components = uri_1.Uri.parse('file://server/share/dir/file.py', true).getPathComponents();
|
406
|
+
assert_1.default.equal(components.length, 4);
|
407
|
+
assert_1.default.ok(components[0].slice(2).includes('server'));
|
408
|
+
assert_1.default.equal(components[1], 'share');
|
409
|
+
assert_1.default.equal(components[2], 'dir');
|
410
|
+
assert_1.default.equal(components[3], 'file.py');
|
411
|
+
});
|
412
|
+
test('getRelativePathComponents1', () => {
|
413
|
+
const components = uri_1.Uri.parse('foo:///users/', true).getRelativePathComponents(uri_1.Uri.parse('foo:///users/', true));
|
414
|
+
assert_1.default.equal(components.length, 0);
|
415
|
+
});
|
416
|
+
test('getRelativePathComponents2', () => {
|
417
|
+
const components = uri_1.Uri.parse('foo:///users/', true).getRelativePathComponents(uri_1.Uri.parse('foo:///users/bar', true));
|
418
|
+
assert_1.default.equal(components.length, 1);
|
419
|
+
assert_1.default.equal(components[0], 'bar');
|
420
|
+
});
|
421
|
+
test('getRelativePathComponents3', () => {
|
422
|
+
const components = uri_1.Uri.parse('bar:///users/', true).getRelativePathComponents(uri_1.Uri.parse('foo:///users/bar', true));
|
423
|
+
assert_1.default.equal(components.length, 1);
|
424
|
+
assert_1.default.equal(components[0], 'bar');
|
425
|
+
});
|
426
|
+
test('getRelativePathComponents4', () => {
|
427
|
+
const components = uri_1.Uri.parse('foo:///users', true).getRelativePathComponents(uri_1.Uri.parse('foo:///users/', true));
|
428
|
+
assert_1.default.equal(components.length, 0);
|
429
|
+
});
|
430
|
+
test('getRelativePathComponents5', () => {
|
431
|
+
const components = uri_1.Uri.parse('foo:///users/', true).getRelativePathComponents(uri_1.Uri.parse('foo:///users/bar/baz/../foo', true));
|
432
|
+
assert_1.default.equal(components.length, 2);
|
433
|
+
assert_1.default.equal(components[0], 'bar');
|
434
|
+
assert_1.default.equal(components[1], 'foo');
|
435
|
+
});
|
436
|
+
test('getRelativePathComponents6', () => {
|
437
|
+
const components = uri_1.Uri.parse('foo:///users/bar', true).getRelativePathComponents(uri_1.Uri.parse('foo:///users/foo', true));
|
438
|
+
assert_1.default.equal(components.length, 2);
|
439
|
+
assert_1.default.equal(components[0], '..');
|
440
|
+
assert_1.default.equal(components[1], 'foo');
|
441
|
+
});
|
442
|
+
test('getFileExtension1', () => {
|
443
|
+
const ext = uri_1.Uri.parse('foo:///blah.blah/hello.JsOn', true).lastExtension;
|
444
|
+
assert_1.default.equal(ext, '.JsOn');
|
445
|
+
});
|
446
|
+
test('getFileName1', () => {
|
447
|
+
const fileName = uri_1.Uri.parse('foo:///blah.blah/HeLLo.JsOn', true).fileName;
|
448
|
+
assert_1.default.equal(fileName, 'HeLLo.JsOn');
|
449
|
+
});
|
450
|
+
test('getFileName2', () => {
|
451
|
+
const fileName1 = uri_1.Uri.parse('foo:///blah.blah/hello.cpython-32m.so', true).fileName;
|
452
|
+
assert_1.default.equal(fileName1, 'hello.cpython-32m.so');
|
453
|
+
});
|
454
|
+
test('stripFileExtension1', () => {
|
455
|
+
const path = uri_1.Uri.parse('foo:///blah.blah/HeLLo.JsOn', true).stripExtension().getPath();
|
456
|
+
assert_1.default.equal(path, '/blah.blah/HeLLo');
|
457
|
+
});
|
458
|
+
test('stripFileExtension2', () => {
|
459
|
+
const path1 = uri_1.Uri.parse('foo:/blah.blah/hello.cpython-32m.so', true).stripAllExtensions().getPath();
|
460
|
+
assert_1.default.equal(path1, '/blah.blah/hello');
|
461
|
+
const path2 = uri_1.Uri.parse('foo:/blah.blah/hello.cpython-32m.so', true).stripExtension().getPath();
|
462
|
+
assert_1.default.equal(path2, '/blah.blah/hello.cpython-32m');
|
463
|
+
});
|
464
|
+
test('getWildcardRegexPattern1', () => {
|
465
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me', true), './blah/');
|
466
|
+
const regex = new RegExp(pattern);
|
467
|
+
assert_1.default.ok(regex.test('/users/me/blah/d'));
|
468
|
+
assert_1.default.ok(!regex.test('/users/me/blad/d'));
|
469
|
+
});
|
470
|
+
test('getWildcardRegexPattern2', () => {
|
471
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me', true), './**/*.py?');
|
472
|
+
const regex = new RegExp(pattern);
|
473
|
+
assert_1.default.ok(regex.test('/users/me/.blah/foo.pyd'));
|
474
|
+
assert_1.default.ok(!regex.test('/users/me/.blah/foo.py')); // No char after
|
475
|
+
});
|
476
|
+
test('getWildcardRegexPattern3', () => {
|
477
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me', true), './**/.*.py');
|
478
|
+
const regex = new RegExp(pattern);
|
479
|
+
assert_1.default.ok(regex.test('/users/me/.blah/.foo.py'));
|
480
|
+
assert_1.default.ok(!regex.test('/users/me/.blah/foo.py'));
|
481
|
+
});
|
482
|
+
test('getWildcardRegexPattern4', () => {
|
483
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('//server/share/dir', true), '.');
|
484
|
+
const regex = new RegExp(pattern);
|
485
|
+
assert_1.default.ok(regex.test('//server/share/dir/foo.py'));
|
486
|
+
assert_1.default.ok(!regex.test('//server/share/dix/foo.py'));
|
487
|
+
});
|
488
|
+
test('getWildcardRoot1', () => {
|
489
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:///users/me', true), './blah/');
|
490
|
+
assert_1.default.equal(p.toString(), 'foo:///users/me/blah');
|
491
|
+
});
|
492
|
+
test('getWildcardRoot2', () => {
|
493
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:///users/me', true), './**/*.py?/');
|
494
|
+
assert_1.default.equal(p.toString(), 'foo:///users/me');
|
495
|
+
});
|
496
|
+
test('getWildcardRoot with root', () => {
|
497
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:///', true), '.');
|
498
|
+
assert_1.default.equal(p.toString(), 'foo:///');
|
499
|
+
});
|
500
|
+
test('getWildcardRoot with drive letter', () => {
|
501
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('file:///c:/', true), '.');
|
502
|
+
assert_1.default.equal(p.toString(), 'file:///c%3A');
|
503
|
+
});
|
504
|
+
function resolvePaths(uri, ...paths) {
|
505
|
+
return uri_1.Uri.file(uri)
|
506
|
+
.combinePaths(...paths)
|
507
|
+
.toString();
|
508
|
+
}
|
509
|
+
test('resolvePath1', () => {
|
510
|
+
assert_1.default.equal(resolvePaths('/path', 'to', 'file.ext'), 'file:///path/to/file.ext');
|
511
|
+
});
|
512
|
+
test('resolvePath2', () => {
|
513
|
+
assert_1.default.equal(resolvePaths('/path', 'to', '..', 'from', 'file.ext/'), 'file:///path/from/file.ext');
|
514
|
+
});
|
515
|
+
function getHomeDirUri() {
|
516
|
+
return uri_1.Uri.file(os.homedir());
|
517
|
+
}
|
518
|
+
test('resolvePath3 ~ escape', () => {
|
519
|
+
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(uri_1.Uri.empty(), '~/path'), 'to', '..', 'from', 'file.ext/'), `${getHomeDirUri().toString()}/path/from/file.ext`);
|
520
|
+
});
|
521
|
+
test('resolvePath4 ~ escape in middle', () => {
|
522
|
+
assert_1.default.equal(resolvePaths('/path', (0, envVarUtils_1.expandPathVariables)(uri_1.Uri.empty(), '~/file.ext/')), `${getHomeDirUri().toString()}/file.ext`);
|
523
|
+
});
|
524
|
+
function combinePaths(uri, ...paths) {
|
525
|
+
return resolvePaths(uri, ...paths);
|
526
|
+
}
|
527
|
+
test('invalid ~ without root', () => {
|
528
|
+
const path = combinePaths('Library', 'Mobile Documents', 'com~apple~CloudDocs', 'Development', 'mysuperproject');
|
529
|
+
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(uri_1.Uri.parse('foo:///src', true), path)), path);
|
530
|
+
});
|
531
|
+
test('invalid ~ with root', () => {
|
532
|
+
const path = combinePaths('/', 'Library', 'com~apple~CloudDocs', 'Development', 'mysuperproject');
|
533
|
+
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(uri_1.Uri.parse('foo:///src', true), path)), path);
|
534
|
+
});
|
535
|
+
function containsPath(uri, child) {
|
536
|
+
return uri_1.Uri.parse(child, true).isChild(uri_1.Uri.parse(uri, true));
|
537
|
+
}
|
538
|
+
test('containsPath1', () => {
|
539
|
+
assert_1.default.equal(containsPath('/a/b/c/', '/a/d/../b/c/./d'), true);
|
540
|
+
});
|
541
|
+
test('containsPath2', () => {
|
542
|
+
assert_1.default.equal(containsPath('/', '\\a'), true);
|
543
|
+
});
|
544
|
+
test('containsPath3', () => {
|
545
|
+
assert_1.default.equal(containsPath('/a', '/a/B'), true);
|
546
|
+
});
|
547
|
+
function getAnyExtensionFromPath(uri) {
|
548
|
+
return uri_1.Uri.parse(uri, true).lastExtension;
|
549
|
+
}
|
550
|
+
test('getAnyExtension1', () => {
|
551
|
+
assert_1.default.equal(getAnyExtensionFromPath('/path/to/file.ext'), '.ext');
|
552
|
+
});
|
553
|
+
function getBaseFileName(uri) {
|
554
|
+
return uri_1.Uri.parse(uri, true).fileName;
|
555
|
+
}
|
556
|
+
test('getBaseFileName1', () => {
|
557
|
+
assert_1.default.equal(getBaseFileName('/path/to/file.ext'), 'file.ext');
|
558
|
+
});
|
559
|
+
test('getBaseFileName2', () => {
|
560
|
+
assert_1.default.equal(getBaseFileName('/path/to/'), 'to');
|
561
|
+
});
|
562
|
+
test('getBaseFileName3', () => {
|
563
|
+
assert_1.default.equal(getBaseFileName('c:/'), '');
|
564
|
+
});
|
565
|
+
function getUriRootLength(uri) {
|
566
|
+
return uri_1.Uri.file(uri).getRootPathLength();
|
567
|
+
}
|
568
|
+
test('getRootLength1', () => {
|
569
|
+
assert_1.default.equal(getUriRootLength('a'), 1);
|
570
|
+
});
|
571
|
+
test('getRootLength2', () => {
|
572
|
+
assert_1.default.equal(getUriRootLength('/'), 1);
|
573
|
+
});
|
574
|
+
test('getRootLength3', () => {
|
575
|
+
assert_1.default.equal(getUriRootLength('c:'), 2);
|
576
|
+
});
|
577
|
+
test('getRootLength4', () => {
|
578
|
+
assert_1.default.equal(getUriRootLength('c:d'), 0);
|
579
|
+
});
|
580
|
+
test('getRootLength5', () => {
|
581
|
+
assert_1.default.equal(getUriRootLength('c:/'), 2);
|
582
|
+
});
|
583
|
+
test('getRootLength6', () => {
|
584
|
+
assert_1.default.equal(getUriRootLength('//server'), 9);
|
585
|
+
});
|
586
|
+
test('getRootLength7', () => {
|
587
|
+
assert_1.default.equal(getUriRootLength('//server/share'), 9);
|
588
|
+
});
|
589
|
+
test('getRootLength8', () => {
|
590
|
+
assert_1.default.equal(getUriRootLength('scheme:/no/authority'), 1);
|
591
|
+
});
|
592
|
+
test('getRootLength9', () => {
|
593
|
+
assert_1.default.equal(getUriRootLength('scheme://with/authority'), 1);
|
594
|
+
});
|
595
|
+
function isRootedDiskUri(uri) {
|
596
|
+
return (0, pathUtils_1.isRootedDiskPath)(uri_1.Uri.file(uri).getFilePath());
|
597
|
+
}
|
598
|
+
test('isRootedDiskPath1', () => {
|
599
|
+
(0, assert_1.default)(isRootedDiskUri('C:/a/b'));
|
600
|
+
});
|
601
|
+
test('isRootedDiskPath2', () => {
|
602
|
+
(0, assert_1.default)(isRootedDiskUri('/'));
|
603
|
+
});
|
604
|
+
test('isRootedDiskPath3', () => {
|
605
|
+
(0, assert_1.default)(isRootedDiskUri('a/b'));
|
606
|
+
});
|
607
|
+
test('isDiskPathRoot1', () => {
|
608
|
+
(0, assert_1.default)(isRootedDiskUri('/'));
|
609
|
+
});
|
610
|
+
test('isDiskPathRoot2', () => {
|
611
|
+
(0, assert_1.default)(isRootedDiskUri('c:/'));
|
612
|
+
});
|
613
|
+
test('isDiskPathRoot3', () => {
|
614
|
+
(0, assert_1.default)(isRootedDiskUri('c:'));
|
615
|
+
});
|
616
|
+
test('isDiskPathRoot4', () => {
|
617
|
+
(0, assert_1.default)(!isRootedDiskUri('c:d'));
|
618
|
+
});
|
619
|
+
function getRelativePath(parent, child) {
|
620
|
+
return uri_1.Uri.parse(parent, true).getRelativePath(uri_1.Uri.parse(child, true));
|
621
|
+
}
|
622
|
+
test('getRelativePath', () => {
|
623
|
+
assert_1.default.equal(getRelativePath('/a/b/c', '/a/b/c/d/e/f'), './d/e/f');
|
624
|
+
assert_1.default.equal(getRelativePath('/a/b/c/d/e/f', '/a/b/c/'), undefined);
|
625
|
+
assert_1.default.equal(getRelativePath('/a/b/c', '/d/e/f'), undefined);
|
626
|
+
});
|
627
|
+
test('CaseSensitivity', () => {
|
628
|
+
const cwd = '/';
|
629
|
+
const fsCaseInsensitive = new vfs.TestFileSystem(/*ignoreCase*/ true, { cwd });
|
630
|
+
assert_1.default.equal((0, uriUtils_1.isFileSystemCaseSensitiveInternal)(fsCaseInsensitive, fsCaseInsensitive), false);
|
631
|
+
const fsCaseSensitive = new vfs.TestFileSystem(/*ignoreCase*/ false, { cwd });
|
632
|
+
assert_1.default.equal((0, uriUtils_1.isFileSystemCaseSensitiveInternal)(fsCaseSensitive, fsCaseSensitive), true);
|
633
|
+
});
|
634
|
+
test('deduplicateFolders', () => {
|
635
|
+
const listOfFolders = [
|
636
|
+
['/user', '/user/temp', '/xuser/app', '/lib/python', '/home/p/.venv/lib/site-packages'].map((p) => uri_1.Uri.file(p)),
|
637
|
+
['/user', '/user/temp', '/xuser/app', '/lib/python/Python310.zip', '/home/z/.venv/lib/site-packages'].map((p) => uri_1.Uri.file(p)),
|
638
|
+
['/main/python/lib/site-packages', '/home/p'].map((p) => uri_1.Uri.file(p)),
|
639
|
+
];
|
640
|
+
const folders = (0, uriUtils_1.deduplicateFolders)(listOfFolders).map((f) => f.getPath());
|
641
|
+
const expected = [
|
642
|
+
'/user',
|
643
|
+
'/xuser/app',
|
644
|
+
'/lib/python',
|
645
|
+
'/home/z/.venv/lib/site-packages',
|
646
|
+
'/main/python/lib/site-packages',
|
647
|
+
'/home/p',
|
648
|
+
];
|
649
|
+
assert_1.default.deepStrictEqual(folders.sort(), expected.sort());
|
650
|
+
});
|
651
|
+
test('convert UNC path', () => {
|
652
|
+
const path = uri_1.Uri.file('file:///server/c$/folder/file.py');
|
653
|
+
// When converting UNC path, server part shouldn't be removed.
|
654
|
+
(0, assert_1.default)(path.getPath().indexOf('server') > 0);
|
655
|
+
});
|
656
|
+
function lowerCaseDrive(entries) {
|
657
|
+
return entries.map((p) => (process.platform === 'win32' ? p[0].toLowerCase() + p.slice(1) : p));
|
658
|
+
}
|
659
|
+
test('Realcase', () => {
|
660
|
+
const fs = (0, realFileSystem_1.createFromRealFileSystem)();
|
661
|
+
const cwd = process.cwd();
|
662
|
+
const dir = uri_1.Uri.file(path.join(cwd, 'src', 'tests', '..', 'tests'));
|
663
|
+
const dirFilePath = dir.getFilePath();
|
664
|
+
const entries = nodefs
|
665
|
+
.readdirSync(dirFilePath)
|
666
|
+
.map((entry) => path.basename(nodefs.realpathSync(path.join(dirFilePath, entry))));
|
667
|
+
const normalizedEntries = lowerCaseDrive(entries);
|
668
|
+
const fsentries = fs.readdirSync(dir);
|
669
|
+
assert_1.default.deepStrictEqual(normalizedEntries, fsentries);
|
670
|
+
const paths = entries.map((entry) => nodefs.realpathSync(path.join(dirFilePath, entry)));
|
671
|
+
const fspaths = fsentries.map((entry) => fs.realCasePath(dir.combinePaths(entry)).getFilePath());
|
672
|
+
assert_1.default.deepStrictEqual(lowerCaseDrive(paths), fspaths);
|
673
|
+
// Check that the '..' has been removed.
|
674
|
+
assert_1.default.ok(!fspaths.some((p) => p.toString().indexOf('..') >= 0));
|
675
|
+
// If windows, check that the case is correct.
|
676
|
+
if (process.platform === 'win32') {
|
677
|
+
for (const p of fspaths) {
|
678
|
+
const upper = uri_1.Uri.file(p.toString().toUpperCase());
|
679
|
+
const real = fs.realCasePath(upper);
|
680
|
+
assert_1.default.strictEqual(p, real.getFilePath());
|
681
|
+
}
|
682
|
+
}
|
683
|
+
});
|
684
|
+
test('Realcase use cwd implicitly', () => {
|
685
|
+
const fs = (0, realFileSystem_1.createFromRealFileSystem)();
|
686
|
+
const cwd = process.cwd();
|
687
|
+
const dir = path.join(cwd, 'src', 'tests');
|
688
|
+
const uri = uri_1.Uri.file(dir);
|
689
|
+
const entries = nodefs.readdirSync(dir).map((entry) => path.basename(nodefs.realpathSync(path.join(dir, entry))));
|
690
|
+
const fsentries = fs.readdirSync(uri);
|
691
|
+
const paths = entries.map((entry) => nodefs.realpathSync(path.join(dir, entry)));
|
692
|
+
const fspaths = fsentries.map((entry) => fs.realCasePath(uri.combinePaths(entry)).getFilePath());
|
693
|
+
assert_1.default.deepStrictEqual(lowerCaseDrive(paths), fspaths);
|
694
|
+
});
|
695
|
+
//# sourceMappingURL=uri.test.js.map
|