@zzzen/pyright-internal 1.2.0-dev.20240317 → 1.2.0-dev.20240331
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.js +1 -1
- package/dist/analyzer/analyzerFileInfo.js.map +1 -1
- package/dist/analyzer/binder.js +4 -1
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/cacheManager.d.ts +1 -0
- package/dist/analyzer/cacheManager.js +4 -1
- package/dist/analyzer/cacheManager.js.map +1 -1
- package/dist/analyzer/checker.d.ts +1 -2
- package/dist/analyzer/checker.js +16 -11
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constructors.d.ts +3 -2
- package/dist/analyzer/constructors.js +76 -54
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +2 -0
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.js +1 -1
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/deprecatedSymbols.js +40 -40
- package/dist/analyzer/deprecatedSymbols.js.map +1 -1
- package/dist/analyzer/enums.js +1 -0
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.js +25 -23
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/namedTuples.js +2 -0
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +1 -1
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +1 -1
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/patternMatching.js +14 -3
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +1 -7
- package/dist/analyzer/program.js +15 -19
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/programTypes.d.ts +11 -0
- package/dist/analyzer/programTypes.js +11 -0
- package/dist/analyzer/programTypes.js.map +1 -0
- package/dist/analyzer/properties.js +2 -8
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js +1 -2
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/service.d.ts +2 -2
- package/dist/analyzer/service.js +20 -14
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js +4 -4
- 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/staticExpressions.js +52 -30
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/tracePrinter.js +2 -2
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +81 -56
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeGuards.js +14 -7
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +2 -2
- package/dist/analyzer/typeUtils.js +41 -5
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +3 -0
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/backgroundAnalysis.js +1 -1
- package/dist/backgroundAnalysis.js.map +1 -1
- package/dist/backgroundAnalysisBase.js +1 -1
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.js +23 -11
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/commandController.d.ts +2 -1
- package/dist/commands/commandController.js +3 -0
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/createTypeStub.d.ts +1 -1
- package/dist/commands/createTypeStub.js +3 -3
- package/dist/commands/createTypeStub.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.d.ts +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/commands/quickActionCommand.d.ts +1 -1
- package/dist/commands/quickActionCommand.js +2 -2
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/commands/restartServer.d.ts +1 -1
- package/dist/common/cancellationUtils.js +2 -2
- package/dist/common/cancellationUtils.js.map +1 -1
- package/dist/common/caseSensitivityDetector.d.ts +6 -0
- package/dist/common/caseSensitivityDetector.js +18 -0
- package/dist/common/caseSensitivityDetector.js.map +1 -0
- package/dist/common/commandLineOptions.d.ts +3 -2
- package/dist/common/commandLineOptions.js.map +1 -1
- package/dist/common/commandUtils.js +1 -1
- package/dist/common/commandUtils.js.map +1 -1
- package/dist/common/configOptions.js +7 -7
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/envVarUtils.d.ts +1 -0
- package/dist/common/envVarUtils.js +42 -7
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +1 -1
- package/dist/common/fileBasedCancellationUtils.js +2 -2
- package/dist/common/fileBasedCancellationUtils.js.map +1 -1
- package/dist/common/fileSystem.d.ts +0 -1
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/fullAccessHost.js +11 -6
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/languageServerInterface.d.ts +62 -0
- package/dist/common/languageServerInterface.js +10 -0
- package/dist/common/languageServerInterface.js.map +1 -0
- package/dist/common/pythonVersion.d.ts +36 -20
- package/dist/common/pythonVersion.js +160 -54
- package/dist/common/pythonVersion.js.map +1 -1
- package/dist/common/realFileSystem.d.ts +8 -4
- package/dist/common/realFileSystem.js +56 -17
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/serviceKeys.d.ts +21 -0
- package/dist/common/serviceKeys.js +26 -0
- package/dist/common/serviceKeys.js.map +1 -0
- package/dist/common/serviceProviderExtensions.d.ts +2 -16
- package/dist/common/serviceProviderExtensions.js +19 -27
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/textEditTracker.js +2 -2
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/uri/constantUri.d.ts +36 -0
- package/dist/common/uri/constantUri.js +112 -0
- package/dist/common/uri/constantUri.js.map +1 -0
- package/dist/common/uri/emptyUri.d.ts +3 -31
- package/dist/common/uri/emptyUri.js +3 -84
- package/dist/common/uri/emptyUri.js.map +1 -1
- package/dist/common/uri/fileUri.d.ts +1 -0
- package/dist/common/uri/fileUri.js +3 -2
- package/dist/common/uri/fileUri.js.map +1 -1
- package/dist/common/uri/uri.d.ts +11 -3
- package/dist/common/uri/uri.js +31 -20
- package/dist/common/uri/uri.js.map +1 -1
- package/dist/common/uri/uriUtils.d.ts +11 -5
- package/dist/common/uri/uriUtils.js +31 -53
- package/dist/common/uri/uriUtils.js.map +1 -1
- package/dist/common/workspaceEditUtils.js +4 -4
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +9 -57
- package/dist/languageServerBase.js +18 -8
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.d.ts +1 -1
- package/dist/languageService/analyzerServiceExecutor.js +4 -5
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +6 -6
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.js +43 -42
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +4 -4
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/definitionProvider.js +2 -2
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js +2 -2
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.d.ts +3 -2
- package/dist/languageService/documentSymbolProvider.js +3 -2
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/referencesProvider.js +2 -2
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js +2 -2
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.d.ts +4 -1
- package/dist/languageService/symbolIndexer.js +21 -11
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.js +1 -1
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.js +21 -16
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +1 -0
- package/dist/localization/package.nls.de.json +1 -0
- package/dist/localization/package.nls.es.json +1 -0
- package/dist/localization/package.nls.fr.json +1 -0
- package/dist/localization/package.nls.it.json +1 -0
- package/dist/localization/package.nls.ja.json +1 -0
- package/dist/localization/package.nls.ko.json +1 -0
- package/dist/localization/package.nls.pl.json +1 -0
- package/dist/localization/package.nls.pt-br.json +1 -0
- package/dist/localization/package.nls.qps-ploc.json +1 -0
- package/dist/localization/package.nls.ru.json +1 -0
- package/dist/localization/package.nls.tr.json +1 -0
- package/dist/localization/package.nls.zh-cn.json +1 -0
- package/dist/localization/package.nls.zh-tw.json +1 -0
- package/dist/parser/parser.js +24 -21
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/unicode.js +3456 -2853
- package/dist/parser/unicode.js.map +1 -1
- package/dist/pyright.js +7 -7
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +3 -1
- package/dist/pyrightFileSystem.js +14 -9
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +0 -1
- package/dist/readonlyAugmentedFileSystem.js +0 -3
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +14 -10
- package/dist/server.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +12 -12
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +11 -11
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/completions.test.js +4 -4
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/config.test.js +26 -21
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/documentSymbolCollector.test.js +2 -3
- package/dist/tests/documentSymbolCollector.test.js.map +1 -1
- package/dist/tests/envVarUtils.test.js +77 -2
- package/dist/tests/envVarUtils.test.js.map +1 -1
- package/dist/tests/filesystem.test.js +13 -13
- package/dist/tests/filesystem.test.js.map +1 -1
- package/dist/tests/fourSlashParser.test.js +12 -12
- package/dist/tests/fourSlashParser.test.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js +12 -10
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashTypes.d.ts +1 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.d.ts +3 -2
- package/dist/tests/harness/fourslash/testLanguageService.js +2 -2
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +3 -3
- package/dist/tests/harness/fourslash/testState.js +36 -32
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +1 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
- package/dist/tests/harness/testHost.d.ts +7 -0
- package/dist/tests/harness/testHost.js +33 -14
- package/dist/tests/harness/testHost.js.map +1 -1
- package/dist/tests/harness/vfs/factory.d.ts +3 -4
- package/dist/tests/harness/vfs/factory.js +7 -6
- package/dist/tests/harness/vfs/factory.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.d.ts +5 -3
- package/dist/tests/harness/vfs/filesystem.js +22 -15
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/importResolver.test.js +35 -34
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js +5 -6
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/languageServer.test.js +1 -1
- package/dist/tests/languageServer.test.js.map +1 -1
- package/dist/tests/logger.test.js +1 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/lsp/customLsp.d.ts +1 -1
- package/dist/tests/lsp/languageServer.js +7 -5
- package/dist/tests/lsp/languageServer.js.map +1 -1
- package/dist/tests/lsp/languageServerTestUtils.js +21 -16
- package/dist/tests/lsp/languageServerTestUtils.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +1 -2
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/pyrightFileSystem.test.js +6 -5
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/serialization.test.js +5 -5
- package/dist/tests/serialization.test.js.map +1 -1
- package/dist/tests/service.test.js +16 -25
- package/dist/tests/service.test.js.map +1 -1
- package/dist/tests/sourceFile.test.js +8 -5
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +4 -4
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/testState.test.js +5 -5
- package/dist/tests/testState.test.js.map +1 -1
- package/dist/tests/testStateUtils.js +6 -6
- package/dist/tests/testStateUtils.js.map +1 -1
- package/dist/tests/testUtils.js +6 -4
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +16 -12
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +2 -2
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +57 -57
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +21 -21
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +27 -27
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/tests/uri.test.js +220 -199
- package/dist/tests/uri.test.js.map +1 -1
- package/dist/tests/workspaceEditUtils.test.js +7 -7
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/tests/zipfs.test.js +7 -5
- package/dist/tests/zipfs.test.js.map +1 -1
- package/dist/workspaceFactory.d.ts +15 -6
- package/dist/workspaceFactory.js +16 -10
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +5 -5
package/dist/tests/uri.test.js
CHANGED
@@ -43,273 +43,284 @@ const realFileSystem_1 = require("../common/realFileSystem");
|
|
43
43
|
const uri_1 = require("../common/uri/uri");
|
44
44
|
const uriUtils_1 = require("../common/uri/uriUtils");
|
45
45
|
const vfs = __importStar(require("./harness/vfs/filesystem"));
|
46
|
+
const testHost_1 = require("./harness/testHost");
|
47
|
+
const caseDetector = new testHost_1.TestCaseSensitivityDetector(true);
|
46
48
|
test('parse', () => {
|
47
|
-
assert_1.default.throws(() => uri_1.Uri.parse('\\c:\\foo : bar',
|
48
|
-
assert_1.default.throws(() => uri_1.Uri.parse('foo:////server/b/c',
|
49
|
-
assert_1.default.ok(uri_1.Uri.parse('foo:///a/b/c',
|
50
|
-
assert_1.default.ok(uri_1.Uri.parse('foo:a/b/c',
|
51
|
-
assert_1.default.ok(uri_1.Uri.parse('foo:/a/b/c',
|
52
|
-
assert_1.default.ok(uri_1.Uri.parse('foo://server/share/dir/file.py',
|
53
|
-
assert_1.default.ok(uri_1.Uri.parse('foo://server/share/dir/file.py?query#fragment',
|
54
|
-
assert_1.default.ok(uri_1.Uri.parse('foo:///c:/users/me',
|
55
|
-
assert_1.default.ok(uri_1.Uri.parse('foo:///c%3A%52users%52me',
|
56
|
-
assert_1.default.ok(uri_1.Uri.parse('',
|
57
|
-
assert_1.default.ok(uri_1.Uri.parse(undefined,
|
49
|
+
assert_1.default.throws(() => uri_1.Uri.parse('\\c:\\foo : bar', caseDetector));
|
50
|
+
assert_1.default.throws(() => uri_1.Uri.parse('foo:////server/b/c', caseDetector)); // No authority component
|
51
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:///a/b/c', caseDetector));
|
52
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:a/b/c', caseDetector));
|
53
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:/a/b/c', caseDetector));
|
54
|
+
assert_1.default.ok(uri_1.Uri.parse('foo://server/share/dir/file.py', caseDetector));
|
55
|
+
assert_1.default.ok(uri_1.Uri.parse('foo://server/share/dir/file.py?query#fragment', caseDetector));
|
56
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:///c:/users/me', caseDetector));
|
57
|
+
assert_1.default.ok(uri_1.Uri.parse('foo:///c%3A%52users%52me', caseDetector));
|
58
|
+
assert_1.default.ok(uri_1.Uri.parse('', caseDetector));
|
59
|
+
assert_1.default.ok(uri_1.Uri.parse(undefined, caseDetector));
|
58
60
|
});
|
59
61
|
test('file', () => {
|
60
62
|
const cwd = process.cwd();
|
61
|
-
const uri1 = uri_1.Uri.file('a/b/c',
|
63
|
+
const uri1 = uri_1.Uri.file('a/b/c', caseDetector, true);
|
62
64
|
assert_1.default.ok(uri1.getFilePath().length > 6);
|
63
65
|
assert_1.default.ok(uri1.getFilePath().toLowerCase().startsWith(cwd.toLowerCase()), `${uri1.getFilePath()} does not start with ${cwd}`);
|
64
|
-
const uri2 = uri_1.Uri.file('a/b/c',
|
66
|
+
const uri2 = uri_1.Uri.file('a/b/c', caseDetector, false);
|
65
67
|
assert_1.default.equal(uri2.getFilePath().length, 6);
|
66
68
|
});
|
69
|
+
test('file path', () => {
|
70
|
+
// parse works with unix style file format
|
71
|
+
assert_1.default.equal(uri_1.Uri.parse('/folder1/folder2', caseDetector).scheme, 'file');
|
72
|
+
// parse doesn't work with window style file format
|
73
|
+
(0, assert_1.default)(uri_1.Uri.parse('c:\\folder1\\folder2', caseDetector).scheme !== `file`);
|
74
|
+
// file works with both styles
|
75
|
+
assert_1.default.equal(uri_1.Uri.file('/folder1/folder2', caseDetector).scheme, 'file');
|
76
|
+
assert_1.default.equal(uri_1.Uri.file('c:\\folder1\\folder2', caseDetector).scheme, 'file');
|
77
|
+
});
|
67
78
|
test('key', () => {
|
68
|
-
const key = uri_1.Uri.parse('foo:///a/b/c',
|
69
|
-
const key2 = uri_1.Uri.parse('foo:///a/b/c',
|
79
|
+
const key = uri_1.Uri.parse('foo:///a/b/c', caseDetector).key;
|
80
|
+
const key2 = uri_1.Uri.parse('foo:///a/b/c', caseDetector).key;
|
70
81
|
assert_1.default.equal(key, key2);
|
71
|
-
const key3 = uri_1.Uri.parse('foo:///a/b/d',
|
82
|
+
const key3 = uri_1.Uri.parse('foo:///a/b/d', caseDetector).key;
|
72
83
|
assert_1.default.notEqual(key, key3);
|
73
|
-
const key4 =
|
84
|
+
const key4 = uriUtils_1.UriEx.file('/a/b/c').key;
|
74
85
|
assert_1.default.notEqual(key, key4);
|
75
|
-
const key5 = uri_1.Uri.parse('file:///a/b/c',
|
86
|
+
const key5 = uri_1.Uri.parse('file:///a/b/c', caseDetector).key;
|
76
87
|
assert_1.default.equal(key4, key5);
|
77
|
-
const key6 =
|
78
|
-
const key7 = uri_1.Uri.parse('file:///c%3A/foo/bar/d.txt',
|
79
|
-
const key8 = uri_1.Uri.parse('file:///c:/foo/bar/d.txt',
|
88
|
+
const key6 = uriUtils_1.UriEx.file((0, pathUtils_1.normalizeSlashes)('c:\\foo\\bar\\d.txt')).key;
|
89
|
+
const key7 = uri_1.Uri.parse('file:///c%3A/foo/bar/d.txt', caseDetector).key;
|
90
|
+
const key8 = uri_1.Uri.parse('file:///c:/foo/bar/d.txt', caseDetector).key;
|
80
91
|
assert_1.default.equal(key6, key7);
|
81
92
|
assert_1.default.equal(key6, key8);
|
82
|
-
const key9 =
|
83
|
-
const key10 =
|
93
|
+
const key9 = uriUtils_1.UriEx.parse('file:///c%3A/foo/bar/D.txt', true).key;
|
94
|
+
const key10 = uriUtils_1.UriEx.parse('file:///c:/foo/bar/d.txt', true).key;
|
84
95
|
assert_1.default.notEqual(key9, key10);
|
85
|
-
const key11 =
|
86
|
-
const key12 =
|
96
|
+
const key11 = uriUtils_1.UriEx.parse('file:///c%3A/foo/bar/D.txt', false).key;
|
97
|
+
const key12 = uriUtils_1.UriEx.parse('file:///c%3A/foo/bar/d.txt', false).key;
|
87
98
|
assert_1.default.equal(key11, key12);
|
88
99
|
});
|
89
100
|
test('filename', () => {
|
90
|
-
const filename = uri_1.Uri.parse('foo:///a/b/c',
|
101
|
+
const filename = uri_1.Uri.parse('foo:///a/b/c', caseDetector).fileName;
|
91
102
|
assert_1.default.equal(filename, 'c');
|
92
|
-
const filename2 = uri_1.Uri.parse('foo:///a/b/c/',
|
103
|
+
const filename2 = uri_1.Uri.parse('foo:///a/b/c/', caseDetector).fileName;
|
93
104
|
assert_1.default.equal(filename2, 'c');
|
94
|
-
const filename3 = uri_1.Uri.parse('foo:///a/b/c.py',
|
105
|
+
const filename3 = uri_1.Uri.parse('foo:///a/b/c.py', caseDetector).fileName;
|
95
106
|
assert_1.default.equal(filename3, 'c.py');
|
96
|
-
const filename4 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment',
|
107
|
+
const filename4 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment', caseDetector).fileName;
|
97
108
|
assert_1.default.equal(filename4, 'c.py');
|
98
|
-
const filename5 =
|
109
|
+
const filename5 = uriUtils_1.UriEx.file('/a/b/c').fileName;
|
99
110
|
assert_1.default.equal(filename5, 'c');
|
100
|
-
const filename6 = uri_1.Uri.parse('file:///a/b/c',
|
111
|
+
const filename6 = uri_1.Uri.parse('file:///a/b/c', caseDetector).fileName;
|
101
112
|
assert_1.default.equal(filename6, 'c');
|
102
113
|
});
|
103
114
|
test('extname', () => {
|
104
|
-
const extname = uri_1.Uri.parse('foo:///a/b/c',
|
115
|
+
const extname = uri_1.Uri.parse('foo:///a/b/c', caseDetector).lastExtension;
|
105
116
|
assert_1.default.equal(extname, '');
|
106
|
-
const extname2 = uri_1.Uri.parse('foo:///a/b/c/',
|
117
|
+
const extname2 = uri_1.Uri.parse('foo:///a/b/c/', caseDetector).lastExtension;
|
107
118
|
assert_1.default.equal(extname2, '');
|
108
|
-
const extname3 = uri_1.Uri.parse('foo:///a/b/c.py',
|
119
|
+
const extname3 = uri_1.Uri.parse('foo:///a/b/c.py', caseDetector).lastExtension;
|
109
120
|
assert_1.default.equal(extname3, '.py');
|
110
|
-
const extname4 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment',
|
121
|
+
const extname4 = uri_1.Uri.parse('foo:///a/b/c.py?query#fragment', caseDetector).lastExtension;
|
111
122
|
assert_1.default.equal(extname4, '.py');
|
112
|
-
const extname5 =
|
123
|
+
const extname5 = uriUtils_1.UriEx.file('/a/b/c.py.foo').lastExtension;
|
113
124
|
assert_1.default.equal(extname5, '.foo');
|
114
|
-
const extname6 = uri_1.Uri.parse('file:///a/b/c.py.foo',
|
125
|
+
const extname6 = uri_1.Uri.parse('file:///a/b/c.py.foo', caseDetector).lastExtension;
|
115
126
|
assert_1.default.equal(extname6, '.foo');
|
116
127
|
});
|
117
128
|
test('fragment', () => {
|
118
|
-
const fragment = uri_1.Uri.parse('foo:///a/b/c#bar',
|
129
|
+
const fragment = uri_1.Uri.parse('foo:///a/b/c#bar', caseDetector).fragment;
|
119
130
|
assert_1.default.equal(fragment, 'bar');
|
120
|
-
const fragment2 = uri_1.Uri.parse('foo:///a/b/c#bar#baz',
|
131
|
+
const fragment2 = uri_1.Uri.parse('foo:///a/b/c#bar#baz', caseDetector).fragment;
|
121
132
|
assert_1.default.equal(fragment2, 'bar#baz');
|
122
|
-
const fragment3 = uri_1.Uri.parse('foo:///a/b/c?query#bar#baz',
|
133
|
+
const fragment3 = uri_1.Uri.parse('foo:///a/b/c?query#bar#baz', caseDetector).fragment;
|
123
134
|
assert_1.default.equal(fragment3, 'bar#baz');
|
124
|
-
const fragment4 = uri_1.Uri.parse('foo:///a/b/c?query',
|
135
|
+
const fragment4 = uri_1.Uri.parse('foo:///a/b/c?query', caseDetector).fragment;
|
125
136
|
assert_1.default.equal(fragment4, '');
|
126
|
-
const fragment5 = uri_1.Uri.parse('foo:///a/b/c',
|
137
|
+
const fragment5 = uri_1.Uri.parse('foo:///a/b/c', caseDetector).withFragment('bar').fragment;
|
127
138
|
assert_1.default.equal(fragment5, 'bar');
|
128
|
-
const fragment6 = uri_1.Uri.parse('foo:///a/b/c#bar',
|
139
|
+
const fragment6 = uri_1.Uri.parse('foo:///a/b/c#bar', caseDetector).withFragment('').fragment;
|
129
140
|
assert_1.default.equal(fragment6, '');
|
130
141
|
});
|
131
142
|
test('query', () => {
|
132
|
-
const query = uri_1.Uri.parse('foo:///a/b/c?bar',
|
143
|
+
const query = uri_1.Uri.parse('foo:///a/b/c?bar', caseDetector).query;
|
133
144
|
assert_1.default.equal(query, 'bar');
|
134
|
-
const query2 = uri_1.Uri.parse('foo:///a/b/c?bar?baz',
|
145
|
+
const query2 = uri_1.Uri.parse('foo:///a/b/c?bar?baz', caseDetector).query;
|
135
146
|
assert_1.default.equal(query2, 'bar?baz');
|
136
|
-
const query3 = uri_1.Uri.parse('foo:///a/b/c?bar?baz#fragment',
|
147
|
+
const query3 = uri_1.Uri.parse('foo:///a/b/c?bar?baz#fragment', caseDetector).query;
|
137
148
|
assert_1.default.equal(query3, 'bar?baz');
|
138
|
-
const query4 = uri_1.Uri.parse('foo:///a/b/c#fragment',
|
149
|
+
const query4 = uri_1.Uri.parse('foo:///a/b/c#fragment', caseDetector).query;
|
139
150
|
assert_1.default.equal(query4, '');
|
140
|
-
const query5 = uri_1.Uri.parse('foo:///a/b/c',
|
151
|
+
const query5 = uri_1.Uri.parse('foo:///a/b/c', caseDetector).withQuery('bar').query;
|
141
152
|
assert_1.default.equal(query5, 'bar');
|
142
|
-
const query6 = uri_1.Uri.parse('foo:///a/b/c?bar',
|
153
|
+
const query6 = uri_1.Uri.parse('foo:///a/b/c?bar', caseDetector).withQuery('').query;
|
143
154
|
assert_1.default.equal(query6, '');
|
144
155
|
});
|
145
156
|
test('containsExtension', () => {
|
146
|
-
const uri1 =
|
157
|
+
const uri1 = uriUtils_1.UriEx.parse('foo:///a/b/c.py', true);
|
147
158
|
assert_1.default.ok(uri1.containsExtension('.py'));
|
148
159
|
assert_1.default.ok(!uri1.containsExtension('.PY'));
|
149
160
|
assert_1.default.ok(!uri1.containsExtension('.pyi'));
|
150
|
-
const uri2 =
|
161
|
+
const uri2 = uriUtils_1.UriEx.parse('foo:///a/b/c.pyi', true);
|
151
162
|
assert_1.default.ok(uri2.containsExtension('.pyi'));
|
152
163
|
assert_1.default.ok(!uri2.containsExtension('.PYI'));
|
153
164
|
assert_1.default.ok(!uri2.containsExtension('.py'));
|
154
|
-
const uri3 =
|
165
|
+
const uri3 = uriUtils_1.UriEx.parse('foo:///a/b/c.pyi.ipynb', false);
|
155
166
|
assert_1.default.ok(uri3.containsExtension('.pyi'));
|
156
167
|
assert_1.default.ok(uri3.containsExtension('.ipynb'));
|
157
168
|
assert_1.default.ok(!uri3.containsExtension('.PYI'));
|
158
169
|
});
|
159
170
|
test('root', () => {
|
160
|
-
const root1 =
|
171
|
+
const root1 = uriUtils_1.UriEx.parse('foo://authority/a/b/c').root;
|
161
172
|
assert_1.default.equal(root1.toString(), 'foo://authority/');
|
162
|
-
const root =
|
173
|
+
const root = uriUtils_1.UriEx.parse('file://server/b/c').root;
|
163
174
|
assert_1.default.equal(root.toString(), 'file://server/');
|
164
175
|
assert_1.default.equal(root.getRootPathLength(), 9);
|
165
|
-
const root2 =
|
176
|
+
const root2 = uriUtils_1.UriEx.parse('foo:/').root;
|
166
177
|
assert_1.default.equal(root2.toString(), 'foo:/');
|
167
|
-
const root3 =
|
178
|
+
const root3 = uriUtils_1.UriEx.parse('foo://a/b/c/').root;
|
168
179
|
assert_1.default.equal(root3.toString(), 'foo://a/');
|
169
180
|
assert_1.default.ok(root3.isRoot());
|
170
|
-
const root4 =
|
181
|
+
const root4 = uriUtils_1.UriEx.parse('foo://a/b/c.py').root;
|
171
182
|
assert_1.default.equal(root4.toString(), 'foo://a/');
|
172
|
-
const root5 =
|
183
|
+
const root5 = uriUtils_1.UriEx.parse('foo://a/b/c.py?query#fragment').root;
|
173
184
|
assert_1.default.equal(root5.toString(), 'foo://a/');
|
174
|
-
const root6 =
|
185
|
+
const root6 = uriUtils_1.UriEx.file('/a/b/c.py.foo').root;
|
175
186
|
assert_1.default.equal(root6.toString(), 'file:///');
|
176
|
-
const root7 =
|
187
|
+
const root7 = uriUtils_1.UriEx.parse('file:///a/b/c.py.foo').root;
|
177
188
|
assert_1.default.equal(root7.toString(), 'file:///');
|
178
189
|
assert_1.default.equal(root7.getRootPathLength(), 1);
|
179
|
-
const root8 =
|
190
|
+
const root8 = uriUtils_1.UriEx.parse('untitled:Untitled-1').root;
|
180
191
|
assert_1.default.equal(root8.toString(), 'untitled:');
|
181
192
|
assert_1.default.equal(root8.getRootPathLength(), 0);
|
182
193
|
assert_1.default.equal(root8.isRoot(), false);
|
183
|
-
const root9 =
|
194
|
+
const root9 = uriUtils_1.UriEx.parse('file://a/b/c/d.py').root;
|
184
195
|
assert_1.default.equal(root9.toString(), 'file://a/');
|
185
196
|
assert_1.default.equal(root9.getRootPathLength(), 4);
|
186
197
|
assert_1.default.ok(root9.isRoot());
|
187
|
-
const root10 =
|
198
|
+
const root10 = uriUtils_1.UriEx.parse('file://c%3A/b/c/d.py').root;
|
188
199
|
assert_1.default.equal(root10.toString(), 'file://c:/');
|
189
200
|
assert_1.default.equal(root10.getRootPathLength(), 5);
|
190
201
|
assert_1.default.ok(root10.isRoot());
|
191
202
|
});
|
192
203
|
test('untitled', () => {
|
193
|
-
const untitled =
|
204
|
+
const untitled = uriUtils_1.UriEx.parse('untitled:Untitled-1', true);
|
194
205
|
assert_1.default.equal(untitled.scheme, 'untitled');
|
195
206
|
assert_1.default.equal(untitled.fileName, 'Untitled-1');
|
196
207
|
assert_1.default.equal(untitled.toString(), 'untitled:Untitled-1');
|
197
|
-
const untitled2 =
|
208
|
+
const untitled2 = uriUtils_1.UriEx.parse('untitled:Untitled-1', true);
|
198
209
|
assert_1.default.ok(untitled.equals(untitled2));
|
199
|
-
const untitled3 =
|
210
|
+
const untitled3 = uriUtils_1.UriEx.parse('untitled:Untitled-2', true);
|
200
211
|
assert_1.default.ok(!untitled.equals(untitled3));
|
201
|
-
const untitled4 =
|
212
|
+
const untitled4 = uriUtils_1.UriEx.parse('untitled:Untitled-1.foo.bar', false);
|
202
213
|
assert_1.default.equal(untitled4.scheme, 'untitled');
|
203
214
|
assert_1.default.equal(untitled4.fileName, 'Untitled-1.foo.bar');
|
204
215
|
(0, assert_1.default)(untitled4.containsExtension('.foo'));
|
205
216
|
(0, assert_1.default)(untitled4.containsExtension('.bar'));
|
206
217
|
});
|
207
218
|
test('empty', () => {
|
208
|
-
const empty = uri_1.Uri.parse('',
|
219
|
+
const empty = uri_1.Uri.parse('', caseDetector);
|
209
220
|
assert_1.default.equal(empty.isEmpty(), true);
|
210
|
-
const empty2 = uri_1.Uri.parse('foo:///',
|
221
|
+
const empty2 = uri_1.Uri.parse('foo:///', caseDetector).isEmpty();
|
211
222
|
assert_1.default.equal(empty2, false);
|
212
223
|
const empty3 = uri_1.Uri.empty();
|
213
224
|
assert_1.default.equal(empty3.isEmpty(), true);
|
214
|
-
const empty4 = uri_1.Uri.parse(undefined,
|
225
|
+
const empty4 = uri_1.Uri.parse(undefined, caseDetector);
|
215
226
|
assert_1.default.equal(empty4.isEmpty(), true);
|
216
227
|
assert_1.default.ok(empty4.equals(empty3));
|
217
228
|
assert_1.default.ok(empty3.equals(empty));
|
218
229
|
const combined = empty.combinePaths((0, pathUtils_1.normalizeSlashes)('/d/e/f'));
|
219
|
-
assert_1.default.equal(combined.getFilePath(),
|
230
|
+
assert_1.default.equal(combined.getFilePath(), '');
|
220
231
|
});
|
221
232
|
test('file', () => {
|
222
|
-
const file1 =
|
233
|
+
const file1 = uriUtils_1.UriEx.file((0, pathUtils_1.normalizeSlashes)('/a/b/c')).getFilePath();
|
223
234
|
assert_1.default.equal(file1, (0, pathUtils_1.normalizeSlashes)('/a/b/c'));
|
224
|
-
const file2 =
|
235
|
+
const file2 = uriUtils_1.UriEx.file('file:///a/b/c').getFilePath();
|
225
236
|
assert_1.default.equal(file2, (0, pathUtils_1.normalizeSlashes)('/a/b/c'));
|
226
|
-
const resolved =
|
237
|
+
const resolved = uriUtils_1.UriEx.file((0, pathUtils_1.normalizeSlashes)('/a/b/c')).combinePaths((0, pathUtils_1.normalizeSlashes)('/d/e/f'));
|
227
238
|
assert_1.default.equal(resolved.getFilePath(), (0, pathUtils_1.normalizeSlashes)('/d/e/f'));
|
228
239
|
});
|
229
240
|
test('isUri', () => {
|
230
|
-
const isUri = uri_1.Uri.
|
241
|
+
const isUri = uri_1.Uri.is('foo:///a/b/c');
|
231
242
|
assert_1.default.equal(isUri, false);
|
232
|
-
const isUri2 = uri_1.Uri.
|
243
|
+
const isUri2 = uri_1.Uri.is('/a/b/c');
|
233
244
|
assert_1.default.equal(isUri2, false);
|
234
|
-
const isUri3 = uri_1.Uri.
|
245
|
+
const isUri3 = uri_1.Uri.is(undefined);
|
235
246
|
assert_1.default.equal(isUri3, false);
|
236
|
-
const isUri4 = uri_1.Uri.
|
247
|
+
const isUri4 = uri_1.Uri.is(uri_1.Uri.parse('foo:///a/b/c', caseDetector));
|
237
248
|
assert_1.default.equal(isUri4, true);
|
238
|
-
const isUri5 = uri_1.Uri.
|
249
|
+
const isUri5 = uri_1.Uri.is(uri_1.Uri.empty());
|
239
250
|
assert_1.default.equal(isUri5, true);
|
240
251
|
});
|
241
252
|
test('matchesRegex', () => {
|
242
253
|
const includeFiles = /\.pyi?$/;
|
243
|
-
const uri = uri_1.Uri.parse('file:///a/b/c.pyi',
|
254
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi', caseDetector);
|
244
255
|
assert_1.default.ok(uri.matchesRegex(includeFiles));
|
245
|
-
const uri2 = uri_1.Uri.parse('file:///a/b/c.px',
|
256
|
+
const uri2 = uri_1.Uri.parse('file:///a/b/c.px', caseDetector);
|
246
257
|
assert_1.default.equal(uri2.matchesRegex(includeFiles), false);
|
247
|
-
const uri3 = uri_1.Uri.parse('vscode-vfs:///a/b/c.pyi',
|
258
|
+
const uri3 = uri_1.Uri.parse('vscode-vfs:///a/b/c.pyi', caseDetector);
|
248
259
|
assert_1.default.ok(uri3.matchesRegex(includeFiles));
|
249
260
|
const fileRegex = /^(c:\/foo\/bar)($|\/)/i;
|
250
|
-
const uri4 = uri_1.Uri.parse('file:///C%3A/foo/bar',
|
261
|
+
const uri4 = uri_1.Uri.parse('file:///C%3A/foo/bar', caseDetector);
|
251
262
|
assert_1.default.ok(uri4.matchesRegex(fileRegex));
|
252
|
-
const uri5 = uri_1.Uri.parse('file:///c%3A/foo/bar',
|
263
|
+
const uri5 = uri_1.Uri.parse('file:///c%3A/foo/bar', caseDetector);
|
253
264
|
assert_1.default.ok(uri5.matchesRegex(fileRegex));
|
254
|
-
const uri6 = uri_1.Uri.parse('file:///c:/foo/bar',
|
265
|
+
const uri6 = uri_1.Uri.parse('file:///c:/foo/bar', caseDetector);
|
255
266
|
assert_1.default.ok(uri6.matchesRegex(fileRegex));
|
256
|
-
const uri7 = uri_1.Uri.parse('file:///c:/foo/bar/',
|
267
|
+
const uri7 = uri_1.Uri.parse('file:///c:/foo/bar/', caseDetector);
|
257
268
|
assert_1.default.ok(uri7.matchesRegex(fileRegex));
|
258
|
-
const uri8 = uri_1.Uri.parse('file:///c:/foo/baz/',
|
269
|
+
const uri8 = uri_1.Uri.parse('file:///c:/foo/baz/', caseDetector);
|
259
270
|
assert_1.default.equal(uri8.matchesRegex(fileRegex), false);
|
260
271
|
});
|
261
272
|
test('replaceExtension', () => {
|
262
|
-
const uri = uri_1.Uri.parse('file:///a/b/c.pyi',
|
273
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi', caseDetector);
|
263
274
|
const uri2 = uri.replaceExtension('.py');
|
264
275
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.py');
|
265
|
-
const uri3 = uri_1.Uri.parse('file:///a/b/c',
|
276
|
+
const uri3 = uri_1.Uri.parse('file:///a/b/c', caseDetector);
|
266
277
|
const uri4 = uri3.replaceExtension('.py');
|
267
278
|
assert_1.default.equal(uri4.toString(), 'file:///a/b/c.py');
|
268
|
-
const uri5 = uri_1.Uri.parse('file:///a/b/c.foo.py',
|
279
|
+
const uri5 = uri_1.Uri.parse('file:///a/b/c.foo.py', caseDetector);
|
269
280
|
const uri6 = uri5.replaceExtension('.pyi');
|
270
281
|
assert_1.default.equal(uri6.toString(), 'file:///a/b/c.foo.pyi');
|
271
|
-
const uri7 = uri_1.Uri.parse('memfs:/notebook.ipynb.py?query#fragment',
|
282
|
+
const uri7 = uri_1.Uri.parse('memfs:/notebook.ipynb.py?query#fragment', caseDetector);
|
272
283
|
const uri8 = uri7.replaceExtension('');
|
273
284
|
assert_1.default.equal(uri8.toString(), 'memfs:/notebook.ipynb');
|
274
|
-
const uri9 = uri_1.Uri.parse('untitled:Untitled-1.ipynb.py?query#fragment',
|
285
|
+
const uri9 = uri_1.Uri.parse('untitled:Untitled-1.ipynb.py?query#fragment', caseDetector);
|
275
286
|
const uri10 = uri9.replaceExtension('');
|
276
287
|
assert_1.default.equal(uri10.toString(), 'untitled:Untitled-1.ipynb');
|
277
288
|
});
|
278
289
|
test('addExtension', () => {
|
279
|
-
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
290
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
280
291
|
const uri2 = uri.addExtension('.py');
|
281
292
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyi.py');
|
282
|
-
const uri3 = uri_1.Uri.parse('file:///a/b/c',
|
293
|
+
const uri3 = uri_1.Uri.parse('file:///a/b/c', caseDetector);
|
283
294
|
const uri4 = uri3.addExtension('.py');
|
284
295
|
assert_1.default.equal(uri4.toString(), 'file:///a/b/c.py');
|
285
296
|
});
|
286
297
|
test('addPath', () => {
|
287
|
-
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
298
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
288
299
|
const uri2 = uri.addPath('d');
|
289
300
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyid');
|
290
301
|
});
|
291
302
|
test('getDirectory', () => {
|
292
|
-
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
303
|
+
const uri = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
293
304
|
const uri2 = uri.getDirectory();
|
294
305
|
assert_1.default.equal(uri2.toString(), 'file:///a/b');
|
295
306
|
const uri3 = uri2.getDirectory();
|
296
307
|
assert_1.default.equal(uri3.toString(), 'file:///a');
|
297
|
-
const uri4 = uri_1.Uri.parse('file:///a/b/',
|
308
|
+
const uri4 = uri_1.Uri.parse('file:///a/b/', caseDetector);
|
298
309
|
const uri5 = uri4.getDirectory();
|
299
310
|
assert_1.default.equal(uri5.toString(), 'file:///a');
|
300
311
|
const uri6 = uri4.getDirectory();
|
301
312
|
assert_1.default.ok(uri6.equals(uri5));
|
302
313
|
const uri7 = uri5.getDirectory();
|
303
314
|
assert_1.default.equal(uri7.toString(), 'file:///');
|
304
|
-
const uri8 = uri_1.Uri.parse('memfs:/a',
|
315
|
+
const uri8 = uri_1.Uri.parse('memfs:/a', caseDetector);
|
305
316
|
const uri9 = uri8.getDirectory();
|
306
317
|
assert_1.default.equal(uri9.toString(), 'memfs:/');
|
307
|
-
const uri10 = uri_1.Uri.parse('untitled:a',
|
318
|
+
const uri10 = uri_1.Uri.parse('untitled:a', caseDetector);
|
308
319
|
const uri11 = uri10.getDirectory();
|
309
320
|
assert_1.default.equal(uri11.toString(), 'untitled:');
|
310
321
|
});
|
311
322
|
test('init and pytyped', () => {
|
312
|
-
const uri = uri_1.Uri.parse('file:///a/b/c?query#fragment',
|
323
|
+
const uri = uri_1.Uri.parse('file:///a/b/c?query#fragment', caseDetector);
|
313
324
|
const uri2 = uri.pytypedUri;
|
314
325
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c/py.typed');
|
315
326
|
const uri3 = uri.initPyUri;
|
@@ -320,7 +331,7 @@ test('init and pytyped', () => {
|
|
320
331
|
assert_1.default.equal(uri5.toString(), 'file:///a/b/c.py');
|
321
332
|
const uri6 = uri.packageStubUri;
|
322
333
|
assert_1.default.equal(uri6.toString(), 'file:///a/b/c.pyi');
|
323
|
-
const uri7 = uri_1.Uri.parse('foo://microsoft.com/a/b/c.py',
|
334
|
+
const uri7 = uri_1.Uri.parse('foo://microsoft.com/a/b/c.py', caseDetector);
|
324
335
|
const uri8 = uri7.pytypedUri;
|
325
336
|
assert_1.default.equal(uri8.toString(), 'foo://microsoft.com/a/b/c.py/py.typed');
|
326
337
|
const uri9 = uri7.initPyUri;
|
@@ -333,69 +344,69 @@ test('init and pytyped', () => {
|
|
333
344
|
assert_1.default.equal(uri12.toString(), 'foo://microsoft.com/a/b/c.py.pyi');
|
334
345
|
});
|
335
346
|
test('isChild', () => {
|
336
|
-
const parent =
|
337
|
-
const child =
|
347
|
+
const parent = uriUtils_1.UriEx.parse('file:///a/b/?query#fragment', true);
|
348
|
+
const child = uriUtils_1.UriEx.parse('file:///a/b/c.pyi?query#fragment', true);
|
338
349
|
assert_1.default.ok(child.isChild(parent));
|
339
|
-
const parent2 =
|
340
|
-
const child2 =
|
341
|
-
const child2DifferentCase =
|
350
|
+
const parent2 = uriUtils_1.UriEx.parse('file:///a/b', true);
|
351
|
+
const child2 = uriUtils_1.UriEx.parse('file:///a/b/c.pyi', true);
|
352
|
+
const child2DifferentCase = uriUtils_1.UriEx.parse('file:///a/B/C.pyi', false);
|
342
353
|
assert_1.default.ok(child2.isChild(parent2));
|
343
354
|
assert_1.default.ok(child2DifferentCase.isChild(parent2));
|
344
|
-
const parent3 =
|
345
|
-
const child3 =
|
355
|
+
const parent3 = uriUtils_1.UriEx.parse('file:///a/b/', true);
|
356
|
+
const child3 = uriUtils_1.UriEx.parse('file:///a/b/c.pyi', true);
|
346
357
|
assert_1.default.ok(child3.isChild(parent3));
|
347
|
-
const parent4 =
|
348
|
-
const notChild4 =
|
358
|
+
const parent4 = uriUtils_1.UriEx.parse('file:///a/b/', true);
|
359
|
+
const notChild4 = uriUtils_1.UriEx.parse('file:///a/bb/c.pyi', true);
|
349
360
|
assert_1.default.ok(!notChild4.isChild(parent4));
|
350
361
|
assert_1.default.ok(!notChild4.isChild(parent2));
|
351
|
-
const notChild5 =
|
362
|
+
const notChild5 = uriUtils_1.UriEx.parse('file:///a/b/', true);
|
352
363
|
assert_1.default.ok(!notChild5.isChild(parent4));
|
353
364
|
});
|
354
365
|
test('equals', () => {
|
355
|
-
const uri1 =
|
356
|
-
const uri2 =
|
366
|
+
const uri1 = uriUtils_1.UriEx.parse('file:///a/b/c.pyi?query#fragment', true);
|
367
|
+
const uri2 = uriUtils_1.UriEx.file('/a/b/c.pyi');
|
357
368
|
assert_1.default.ok(!uri1.equals(uri2));
|
358
369
|
const uri3 = uri1.stripExtension().addExtension('.pyi');
|
359
370
|
assert_1.default.ok(uri2.equals(uri3));
|
360
|
-
const uri4 =
|
361
|
-
const uri5 =
|
362
|
-
const uri6 =
|
371
|
+
const uri4 = uriUtils_1.UriEx.parse('foo:///a/b/c', true);
|
372
|
+
const uri5 = uriUtils_1.UriEx.parse('foo:///a/b/c', true);
|
373
|
+
const uri6 = uriUtils_1.UriEx.parse('foo:///a/b/c/', true);
|
363
374
|
assert_1.default.ok(uri4.equals(uri5));
|
364
375
|
assert_1.default.ok(uri4.equals(uri6));
|
365
|
-
const uri7 =
|
366
|
-
const uri8 =
|
376
|
+
const uri7 = uriUtils_1.UriEx.parse('file://c%3A/b/c/d.py', true).root;
|
377
|
+
const uri8 = uriUtils_1.UriEx.parse('file://c:/', true);
|
367
378
|
assert_1.default.ok(uri7.equals(uri8));
|
368
|
-
const uri9 =
|
379
|
+
const uri9 = uriUtils_1.UriEx.parse('foo:///a/b/c?query', true);
|
369
380
|
assert_1.default.ok(!uri9.equals(uri4));
|
370
381
|
// Web uris are always case sensitive
|
371
|
-
const uri10 =
|
372
|
-
const uri11 =
|
382
|
+
const uri10 = uriUtils_1.UriEx.parse('foo:///a/b/c', false);
|
383
|
+
const uri11 = uriUtils_1.UriEx.parse('foo:///a/B/c', false);
|
373
384
|
assert_1.default.ok(!uri10.equals(uri11));
|
374
385
|
// Filre uris pay attention to the parameter.
|
375
|
-
const uri12 =
|
376
|
-
const uri13 =
|
386
|
+
const uri12 = uriUtils_1.UriEx.parse('file:///a/b/c', false);
|
387
|
+
const uri13 = uriUtils_1.UriEx.parse('file:///a/B/c', false);
|
377
388
|
assert_1.default.ok(uri12.equals(uri13));
|
378
|
-
const uri14 =
|
379
|
-
const uri15 =
|
389
|
+
const uri14 = uriUtils_1.UriEx.parse('file:///a/b/c', true);
|
390
|
+
const uri15 = uriUtils_1.UriEx.parse('file:///a/B/c', true);
|
380
391
|
assert_1.default.ok(!uri14.equals(uri15));
|
381
392
|
});
|
382
393
|
test('startsWith', () => {
|
383
|
-
const parent = uri_1.Uri.parse('file:///a/b/?query#fragment',
|
384
|
-
const child = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
394
|
+
const parent = uri_1.Uri.parse('file:///a/b/?query#fragment', caseDetector);
|
395
|
+
const child = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
385
396
|
assert_1.default.ok(child.startsWith(parent));
|
386
|
-
const parent2 = uri_1.Uri.parse('file:///a/b',
|
387
|
-
const child2 = uri_1.Uri.parse('file:///a/b/c.pyi',
|
397
|
+
const parent2 = uri_1.Uri.parse('file:///a/b', caseDetector);
|
398
|
+
const child2 = uri_1.Uri.parse('file:///a/b/c.pyi', caseDetector);
|
388
399
|
assert_1.default.ok(child2.startsWith(parent2));
|
389
|
-
const parent3 = uri_1.Uri.parse('file:///a/b/',
|
390
|
-
const child3 = uri_1.Uri.parse('file:///a/b/c.pyi',
|
400
|
+
const parent3 = uri_1.Uri.parse('file:///a/b/', caseDetector);
|
401
|
+
const child3 = uri_1.Uri.parse('file:///a/b/c.pyi', caseDetector);
|
391
402
|
assert_1.default.ok(child3.startsWith(parent3));
|
392
|
-
const parent4 = uri_1.Uri.parse('file:///a/b/',
|
393
|
-
const notChild4 = uri_1.Uri.parse('file:///a/bb/c.pyi',
|
403
|
+
const parent4 = uri_1.Uri.parse('file:///a/b/', caseDetector);
|
404
|
+
const notChild4 = uri_1.Uri.parse('file:///a/bb/c.pyi', caseDetector);
|
394
405
|
assert_1.default.ok(!notChild4.startsWith(parent4));
|
395
406
|
assert_1.default.ok(!notChild4.startsWith(parent2));
|
396
407
|
});
|
397
408
|
test('path comparisons', () => {
|
398
|
-
const uri = uri_1.Uri.parse('foo:///a/b/c.pyi?query#fragment',
|
409
|
+
const uri = uri_1.Uri.parse('foo:///a/b/c.pyi?query#fragment', caseDetector);
|
399
410
|
assert_1.default.ok(uri.pathEndsWith('c.pyi'));
|
400
411
|
assert_1.default.ok(uri.pathEndsWith('b/c.pyi'));
|
401
412
|
assert_1.default.ok(uri.pathEndsWith('a/b/c.pyi'));
|
@@ -404,7 +415,7 @@ test('path comparisons', () => {
|
|
404
415
|
assert_1.default.ok(uri.pathIncludes('c.pyi'));
|
405
416
|
assert_1.default.ok(uri.pathIncludes('b/c'));
|
406
417
|
assert_1.default.ok(uri.pathIncludes('a/b/c'));
|
407
|
-
const uri2 = uri_1.Uri.parse('file:///C%3A/a/b/c.pyi?query#fragment',
|
418
|
+
const uri2 = uri_1.Uri.parse('file:///C%3A/a/b/c.pyi?query#fragment', caseDetector);
|
408
419
|
assert_1.default.ok(uri2.pathEndsWith('c.pyi'));
|
409
420
|
assert_1.default.ok(uri2.pathEndsWith('b/c.pyi'));
|
410
421
|
assert_1.default.ok(!uri2.pathStartsWith('C:/a'));
|
@@ -413,7 +424,7 @@ test('path comparisons', () => {
|
|
413
424
|
assert_1.default.ok(uri2.pathStartsWith('c:/a/b'));
|
414
425
|
});
|
415
426
|
test('combinePaths', () => {
|
416
|
-
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
427
|
+
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
417
428
|
const uri2 = uri1.combinePaths('d', 'e');
|
418
429
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyi/d/e');
|
419
430
|
const uri4 = uri1.combinePaths('d', 'e', 'f');
|
@@ -424,19 +435,19 @@ test('combinePaths', () => {
|
|
424
435
|
const rootedResult = process.platform === 'win32' ? 'file:///d%3A/e/f' : 'file:///D/e/f';
|
425
436
|
const uri6 = uri1.combinePaths(rootedPath, 'e', 'f');
|
426
437
|
assert_1.default.equal(uri6.toString(), rootedResult);
|
427
|
-
const uri7 = uri_1.Uri.parse('foo:',
|
438
|
+
const uri7 = uri_1.Uri.parse('foo:', caseDetector);
|
428
439
|
const uri8 = uri7.combinePaths('d', 'e');
|
429
440
|
assert_1.default.equal(uri8.toString(), 'foo:d/e');
|
430
|
-
const uri9 = uri_1.Uri.parse('foo:/',
|
441
|
+
const uri9 = uri_1.Uri.parse('foo:/', caseDetector);
|
431
442
|
const uri10 = uri9.combinePaths('d', 'e');
|
432
443
|
assert_1.default.equal(uri10.toString(), 'foo:/d/e');
|
433
444
|
const uri11 = uri_1.Uri.empty().combinePaths('d', 'e');
|
434
|
-
assert_1.default.equal(uri11.toString(),
|
445
|
+
assert_1.default.equal(uri11.toString(), '');
|
435
446
|
const uri12 = uri1.combinePaths('d', 'e', 'f/');
|
436
447
|
assert_1.default.equal(uri12.toString(), 'file:///a/b/c.pyi/d/e/f');
|
437
448
|
});
|
438
449
|
test('combinePathsUnsafe', () => {
|
439
|
-
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
450
|
+
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
440
451
|
const uri2 = uri1.combinePathsUnsafe('d', 'e');
|
441
452
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyi/d/e');
|
442
453
|
const uri4 = uri1.combinePathsUnsafe('d', 'e', 'f');
|
@@ -447,19 +458,19 @@ test('combinePathsUnsafe', () => {
|
|
447
458
|
const rootedResult = process.platform === 'win32' ? 'file:///d%3A/e/f' : 'file:///D/e/f';
|
448
459
|
const uri6 = uri1.combinePathsUnsafe(rootedPath, 'e', 'f');
|
449
460
|
assert_1.default.equal(uri6.toString(), rootedResult);
|
450
|
-
const uri7 = uri_1.Uri.parse('foo:',
|
461
|
+
const uri7 = uri_1.Uri.parse('foo:', caseDetector);
|
451
462
|
const uri8 = uri7.combinePathsUnsafe('d', 'e');
|
452
463
|
assert_1.default.equal(uri8.toString(), 'foo:d/e');
|
453
|
-
const uri9 = uri_1.Uri.parse('foo:/',
|
464
|
+
const uri9 = uri_1.Uri.parse('foo:/', caseDetector);
|
454
465
|
const uri10 = uri9.combinePathsUnsafe('d', 'e');
|
455
466
|
assert_1.default.equal(uri10.toString(), 'foo:/d/e');
|
456
467
|
const uri11 = uri_1.Uri.empty().combinePathsUnsafe('d', 'e');
|
457
|
-
assert_1.default.equal(uri11.toString(),
|
468
|
+
assert_1.default.equal(uri11.toString(), '');
|
458
469
|
const uri12 = uri1.combinePathsUnsafe('d', 'e', 'f/');
|
459
470
|
assert_1.default.equal(uri12.toString(), 'file:///a/b/c.pyi/d/e/f/');
|
460
471
|
});
|
461
472
|
test('resolvePaths', () => {
|
462
|
-
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment',
|
473
|
+
const uri1 = uri_1.Uri.parse('file:///a/b/c.pyi?query#fragment', caseDetector);
|
463
474
|
const uri2 = uri1.resolvePaths('d', 'e');
|
464
475
|
assert_1.default.equal(uri2.toString(), 'file:///a/b/c.pyi/d/e');
|
465
476
|
const uri3 = uri1.resolvePaths('d', 'e/');
|
@@ -472,24 +483,24 @@ test('resolvePaths', () => {
|
|
472
483
|
const rootedResult = process.platform === 'win32' ? 'file:///d%3A/e/f' : 'file:///D/e/f';
|
473
484
|
const uri6 = uri1.resolvePaths(rootedPath, 'e', 'f');
|
474
485
|
assert_1.default.equal(uri6.toString(), rootedResult);
|
475
|
-
const uri7 = uri_1.Uri.parse('foo:',
|
486
|
+
const uri7 = uri_1.Uri.parse('foo:', caseDetector);
|
476
487
|
const uri8 = uri7.resolvePaths('d', 'e');
|
477
488
|
assert_1.default.equal(uri8.toString(), 'foo:d/e');
|
478
|
-
const uri9 = uri_1.Uri.parse('foo:/',
|
489
|
+
const uri9 = uri_1.Uri.parse('foo:/', caseDetector);
|
479
490
|
const uri10 = uri9.resolvePaths('d', 'e');
|
480
491
|
assert_1.default.equal(uri10.toString(), 'foo:/d/e');
|
481
492
|
const uri11 = uri_1.Uri.empty().resolvePaths('d', 'e');
|
482
|
-
assert_1.default.equal(uri11.toString(),
|
493
|
+
assert_1.default.equal(uri11.toString(), '');
|
483
494
|
});
|
484
495
|
test('combinePaths non file', () => {
|
485
|
-
const uri1 = uri_1.Uri.parse('baz://authority/a/b/c.pyi?query#fragment',
|
496
|
+
const uri1 = uri_1.Uri.parse('baz://authority/a/b/c.pyi?query#fragment', caseDetector);
|
486
497
|
const uri2 = uri1.combinePaths('d', 'e');
|
487
498
|
assert_1.default.equal(uri2.toString(), 'baz://authority/a/b/c.pyi/d/e');
|
488
499
|
const uri4 = uri1.combinePaths('d', 'e', 'f');
|
489
500
|
assert_1.default.equal(uri4.toString(), 'baz://authority/a/b/c.pyi/d/e/f');
|
490
501
|
});
|
491
502
|
test('resolvePaths non file', () => {
|
492
|
-
const uri1 = uri_1.Uri.parse('baz://authority/a/b/c.pyi?query#fragment',
|
503
|
+
const uri1 = uri_1.Uri.parse('baz://authority/a/b/c.pyi?query#fragment', caseDetector);
|
493
504
|
const uri2 = uri1.resolvePaths('d', 'e');
|
494
505
|
assert_1.default.equal(uri2.toString(), 'baz://authority/a/b/c.pyi/d/e');
|
495
506
|
const uri3 = uri1.resolvePaths('d', 'e/');
|
@@ -500,36 +511,36 @@ test('resolvePaths non file', () => {
|
|
500
511
|
assert_1.default.equal(uri5.toString(), 'baz://authority/a/b/c.pyi/e');
|
501
512
|
});
|
502
513
|
test('getPathComponents1', () => {
|
503
|
-
const components = uri_1.Uri.parse('',
|
514
|
+
const components = uri_1.Uri.parse('', caseDetector).getPathComponents();
|
504
515
|
assert_1.default.equal(components.length, 0);
|
505
516
|
});
|
506
517
|
test('getPathComponents2', () => {
|
507
|
-
const components = uri_1.Uri.parse('/users/',
|
518
|
+
const components = uri_1.Uri.parse('/users/', caseDetector).getPathComponents();
|
508
519
|
assert_1.default.equal(components.length, 2);
|
509
520
|
assert_1.default.equal(components[0], '/');
|
510
521
|
assert_1.default.equal(components[1], 'users');
|
511
522
|
});
|
512
523
|
test('getPathComponents3', () => {
|
513
|
-
const components = uri_1.Uri.parse('/users/hello.py',
|
524
|
+
const components = uri_1.Uri.parse('/users/hello.py', caseDetector).getPathComponents();
|
514
525
|
assert_1.default.equal(components.length, 3);
|
515
526
|
assert_1.default.equal(components[0], '/');
|
516
527
|
assert_1.default.equal(components[1], 'users');
|
517
528
|
assert_1.default.equal(components[2], 'hello.py');
|
518
529
|
});
|
519
530
|
test('getPathComponents4', () => {
|
520
|
-
const components = uri_1.Uri.parse('/users/hello/../',
|
531
|
+
const components = uri_1.Uri.parse('/users/hello/../', caseDetector).getPathComponents();
|
521
532
|
assert_1.default.equal(components.length, 2);
|
522
533
|
assert_1.default.equal(components[0], '/');
|
523
534
|
assert_1.default.equal(components[1], 'users');
|
524
535
|
});
|
525
536
|
test('getPathComponents5', () => {
|
526
|
-
const components = uri_1.Uri.parse('./hello.py',
|
537
|
+
const components = uri_1.Uri.parse('./hello.py', caseDetector).getPathComponents();
|
527
538
|
assert_1.default.equal(components.length, 2);
|
528
539
|
assert_1.default.equal(components[0], '/');
|
529
540
|
assert_1.default.equal(components[1], 'hello.py');
|
530
541
|
});
|
531
542
|
test('getPathComponents6', () => {
|
532
|
-
const components = uri_1.Uri.parse('file://server/share/dir/file.py',
|
543
|
+
const components = uri_1.Uri.parse('file://server/share/dir/file.py', caseDetector).getPathComponents();
|
533
544
|
assert_1.default.equal(components.length, 4);
|
534
545
|
assert_1.default.ok(components[0].slice(2).includes('server'));
|
535
546
|
assert_1.default.equal(components[1], 'share');
|
@@ -537,104 +548,104 @@ test('getPathComponents6', () => {
|
|
537
548
|
assert_1.default.equal(components[3], 'file.py');
|
538
549
|
});
|
539
550
|
test('getRelativePathComponents1', () => {
|
540
|
-
const components = uri_1.Uri.parse('foo:///users/',
|
551
|
+
const components = uri_1.Uri.parse('foo:///users/', caseDetector).getRelativePathComponents(uri_1.Uri.parse('foo:///users/', caseDetector));
|
541
552
|
assert_1.default.equal(components.length, 0);
|
542
553
|
});
|
543
554
|
test('getRelativePathComponents2', () => {
|
544
|
-
const components = uri_1.Uri.parse('foo:///users/',
|
555
|
+
const components = uri_1.Uri.parse('foo:///users/', caseDetector).getRelativePathComponents(uri_1.Uri.parse('foo:///users/bar', caseDetector));
|
545
556
|
assert_1.default.equal(components.length, 1);
|
546
557
|
assert_1.default.equal(components[0], 'bar');
|
547
558
|
});
|
548
559
|
test('getRelativePathComponents3', () => {
|
549
|
-
const components = uri_1.Uri.parse('bar:///users/',
|
560
|
+
const components = uri_1.Uri.parse('bar:///users/', caseDetector).getRelativePathComponents(uri_1.Uri.parse('foo:///users/bar', caseDetector));
|
550
561
|
assert_1.default.equal(components.length, 1);
|
551
562
|
assert_1.default.equal(components[0], 'bar');
|
552
563
|
});
|
553
564
|
test('getRelativePathComponents4', () => {
|
554
|
-
const components = uri_1.Uri.parse('foo:///users',
|
565
|
+
const components = uri_1.Uri.parse('foo:///users', caseDetector).getRelativePathComponents(uri_1.Uri.parse('foo:///users/', caseDetector));
|
555
566
|
assert_1.default.equal(components.length, 0);
|
556
567
|
});
|
557
568
|
test('getRelativePathComponents5', () => {
|
558
|
-
const components = uri_1.Uri.parse('foo:///users/',
|
569
|
+
const components = uri_1.Uri.parse('foo:///users/', caseDetector).getRelativePathComponents(uri_1.Uri.parse('foo:///users/bar/baz/../foo', caseDetector));
|
559
570
|
assert_1.default.equal(components.length, 2);
|
560
571
|
assert_1.default.equal(components[0], 'bar');
|
561
572
|
assert_1.default.equal(components[1], 'foo');
|
562
573
|
});
|
563
574
|
test('getRelativePathComponents6', () => {
|
564
|
-
const components = uri_1.Uri.parse('foo:///users/bar',
|
575
|
+
const components = uri_1.Uri.parse('foo:///users/bar', caseDetector).getRelativePathComponents(uri_1.Uri.parse('foo:///users/foo', caseDetector));
|
565
576
|
assert_1.default.equal(components.length, 2);
|
566
577
|
assert_1.default.equal(components[0], '..');
|
567
578
|
assert_1.default.equal(components[1], 'foo');
|
568
579
|
});
|
569
580
|
test('getRelativePathComponents7', () => {
|
570
|
-
const components =
|
581
|
+
const components = uriUtils_1.UriEx.file('\\\\SERVER\\share\\users', false).getRelativePathComponents(uriUtils_1.UriEx.file('\\\\server\\ShArE\\users\\bar', false));
|
571
582
|
assert_1.default.equal(components.length, 1);
|
572
583
|
assert_1.default.equal(components[0], 'bar');
|
573
584
|
});
|
574
585
|
test('getFileExtension1', () => {
|
575
|
-
const ext = uri_1.Uri.parse('foo:///blah.blah/hello.JsOn',
|
586
|
+
const ext = uri_1.Uri.parse('foo:///blah.blah/hello.JsOn', caseDetector).lastExtension;
|
576
587
|
assert_1.default.equal(ext, '.JsOn');
|
577
588
|
});
|
578
589
|
test('getFileName1', () => {
|
579
|
-
const fileName = uri_1.Uri.parse('foo:///blah.blah/HeLLo.JsOn',
|
590
|
+
const fileName = uri_1.Uri.parse('foo:///blah.blah/HeLLo.JsOn', caseDetector).fileName;
|
580
591
|
assert_1.default.equal(fileName, 'HeLLo.JsOn');
|
581
592
|
});
|
582
593
|
test('getFileName2', () => {
|
583
|
-
const fileName1 = uri_1.Uri.parse('foo:///blah.blah/hello.cpython-32m.so',
|
594
|
+
const fileName1 = uri_1.Uri.parse('foo:///blah.blah/hello.cpython-32m.so', caseDetector).fileName;
|
584
595
|
assert_1.default.equal(fileName1, 'hello.cpython-32m.so');
|
585
596
|
});
|
586
597
|
test('stripFileExtension1', () => {
|
587
|
-
const path = uri_1.Uri.parse('foo:///blah.blah/HeLLo.JsOn',
|
598
|
+
const path = uri_1.Uri.parse('foo:///blah.blah/HeLLo.JsOn', caseDetector).stripExtension().getPath();
|
588
599
|
assert_1.default.equal(path, '/blah.blah/HeLLo');
|
589
600
|
});
|
590
601
|
test('stripFileExtension2', () => {
|
591
|
-
const path1 = uri_1.Uri.parse('foo:/blah.blah/hello.cpython-32m.so',
|
602
|
+
const path1 = uri_1.Uri.parse('foo:/blah.blah/hello.cpython-32m.so', caseDetector).stripAllExtensions().getPath();
|
592
603
|
assert_1.default.equal(path1, '/blah.blah/hello');
|
593
|
-
const path2 = uri_1.Uri.parse('foo:/blah.blah/hello.cpython-32m.so',
|
604
|
+
const path2 = uri_1.Uri.parse('foo:/blah.blah/hello.cpython-32m.so', caseDetector).stripExtension().getPath();
|
594
605
|
assert_1.default.equal(path2, '/blah.blah/hello.cpython-32m');
|
595
606
|
});
|
596
607
|
test('getWildcardRegexPattern1', () => {
|
597
|
-
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me',
|
608
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me', caseDetector), './blah/');
|
598
609
|
const regex = new RegExp(pattern);
|
599
610
|
assert_1.default.ok(regex.test('/users/me/blah/d'));
|
600
611
|
assert_1.default.ok(!regex.test('/users/me/blad/d'));
|
601
612
|
});
|
602
613
|
test('getWildcardRegexPattern2', () => {
|
603
|
-
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me',
|
614
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me', caseDetector), './**/*.py?');
|
604
615
|
const regex = new RegExp(pattern);
|
605
616
|
assert_1.default.ok(regex.test('/users/me/.blah/foo.pyd'));
|
606
617
|
assert_1.default.ok(!regex.test('/users/me/.blah/foo.py')); // No char after
|
607
618
|
});
|
608
619
|
test('getWildcardRegexPattern3', () => {
|
609
|
-
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me',
|
620
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('foo:///users/me', caseDetector), './**/.*.py');
|
610
621
|
const regex = new RegExp(pattern);
|
611
622
|
assert_1.default.ok(regex.test('/users/me/.blah/.foo.py'));
|
612
623
|
assert_1.default.ok(!regex.test('/users/me/.blah/foo.py'));
|
613
624
|
});
|
614
625
|
test('getWildcardRegexPattern4', () => {
|
615
|
-
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('//server/share/dir',
|
626
|
+
const pattern = (0, uriUtils_1.getWildcardRegexPattern)(uri_1.Uri.parse('//server/share/dir', caseDetector), '.');
|
616
627
|
const regex = new RegExp(pattern);
|
617
628
|
assert_1.default.ok(regex.test('//server/share/dir/foo.py'));
|
618
629
|
assert_1.default.ok(!regex.test('//server/share/dix/foo.py'));
|
619
630
|
});
|
620
631
|
test('getWildcardRoot1', () => {
|
621
|
-
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:/users/me',
|
632
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:/users/me', caseDetector), './blah/');
|
622
633
|
assert_1.default.equal(p.toString(), 'foo:/users/me/blah');
|
623
634
|
});
|
624
635
|
test('getWildcardRoot2', () => {
|
625
|
-
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:/users/me',
|
636
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:/users/me', caseDetector), './**/*.py?/');
|
626
637
|
assert_1.default.equal(p.toString(), 'foo:/users/me');
|
627
638
|
});
|
628
639
|
test('getWildcardRoot with root', () => {
|
629
|
-
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:/',
|
640
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('foo:/', caseDetector), '.');
|
630
641
|
assert_1.default.equal(p.toString(), 'foo:/');
|
631
642
|
});
|
632
643
|
test('getWildcardRoot with drive letter', () => {
|
633
|
-
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('file:///c:/',
|
644
|
+
const p = (0, uriUtils_1.getWildcardRoot)(uri_1.Uri.parse('file:///c:/', caseDetector), '.');
|
634
645
|
assert_1.default.equal(p.toString(), 'file:///c%3A');
|
635
646
|
});
|
636
647
|
function resolvePaths(uri, ...paths) {
|
637
|
-
return
|
648
|
+
return uriUtils_1.UriEx.file(uri)
|
638
649
|
.resolvePaths(...paths)
|
639
650
|
.toString();
|
640
651
|
}
|
@@ -645,7 +656,7 @@ test('resolvePath2', () => {
|
|
645
656
|
assert_1.default.equal(resolvePaths('/path', 'to', '..', 'from', 'file.ext/'), 'file:///path/from/file.ext');
|
646
657
|
});
|
647
658
|
function getHomeDirUri() {
|
648
|
-
return
|
659
|
+
return uriUtils_1.UriEx.file(os.homedir());
|
649
660
|
}
|
650
661
|
test('resolvePath3 ~ escape', () => {
|
651
662
|
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)('~/path', uri_1.Uri.empty(), []), 'to', '..', 'from', 'file.ext/'), `${getHomeDirUri().toString()}/path/from/file.ext`);
|
@@ -658,14 +669,14 @@ function combinePaths(uri, ...paths) {
|
|
658
669
|
}
|
659
670
|
test('invalid ~ without root', () => {
|
660
671
|
const path = combinePaths('Library', 'Mobile Documents', 'com~apple~CloudDocs', 'Development', 'mysuperproject');
|
661
|
-
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(path, uri_1.Uri.parse('foo:///src',
|
672
|
+
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(path, uri_1.Uri.parse('foo:///src', caseDetector), [])), path);
|
662
673
|
});
|
663
674
|
test('invalid ~ with root', () => {
|
664
675
|
const path = combinePaths('/', 'Library', 'com~apple~CloudDocs', 'Development', 'mysuperproject');
|
665
|
-
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(path, uri_1.Uri.parse('foo:///src',
|
676
|
+
assert_1.default.equal(resolvePaths((0, envVarUtils_1.expandPathVariables)(path, uri_1.Uri.parse('foo:///src', caseDetector), [])), path);
|
666
677
|
});
|
667
678
|
function containsPath(uri, child) {
|
668
|
-
return uri_1.Uri.parse(child,
|
679
|
+
return uri_1.Uri.parse(child, caseDetector).isChild(uri_1.Uri.parse(uri, caseDetector));
|
669
680
|
}
|
670
681
|
test('containsPath1', () => {
|
671
682
|
assert_1.default.equal(containsPath('/a/b/c/', '/a/d/../b/c/./d'), true);
|
@@ -677,13 +688,13 @@ test('containsPath3', () => {
|
|
677
688
|
assert_1.default.equal(containsPath('/a', '/a/B'), true);
|
678
689
|
});
|
679
690
|
function getAnyExtensionFromPath(uri) {
|
680
|
-
return uri_1.Uri.parse(uri,
|
691
|
+
return uri_1.Uri.parse(uri, caseDetector).lastExtension;
|
681
692
|
}
|
682
693
|
test('getAnyExtension1', () => {
|
683
694
|
assert_1.default.equal(getAnyExtensionFromPath('/path/to/file.ext'), '.ext');
|
684
695
|
});
|
685
696
|
function getBaseFileName(uri) {
|
686
|
-
return uri_1.Uri.parse(uri,
|
697
|
+
return uri_1.Uri.parse(uri, caseDetector).fileName;
|
687
698
|
}
|
688
699
|
test('getBaseFileName1', () => {
|
689
700
|
assert_1.default.equal(getBaseFileName('/path/to/file.ext'), 'file.ext');
|
@@ -695,7 +706,7 @@ test('getBaseFileName3', () => {
|
|
695
706
|
assert_1.default.equal(getBaseFileName('c:/'), '');
|
696
707
|
});
|
697
708
|
function getUriRootLength(uri) {
|
698
|
-
return
|
709
|
+
return uriUtils_1.UriEx.file(uri).getRootPathLength();
|
699
710
|
}
|
700
711
|
test('getRootLength1', () => {
|
701
712
|
assert_1.default.equal(getUriRootLength('a'), 1);
|
@@ -725,7 +736,7 @@ test('getRootLength9', () => {
|
|
725
736
|
assert_1.default.equal(getUriRootLength('scheme://with/authority'), 1);
|
726
737
|
});
|
727
738
|
function isRootedDiskUri(uri) {
|
728
|
-
return (0, pathUtils_1.isRootedDiskPath)(
|
739
|
+
return (0, pathUtils_1.isRootedDiskPath)(uriUtils_1.UriEx.file(uri).getFilePath());
|
729
740
|
}
|
730
741
|
test('isRootedDiskPath1', () => {
|
731
742
|
(0, assert_1.default)(isRootedDiskUri('C:/a/b'));
|
@@ -749,7 +760,7 @@ test('isDiskPathRoot4', () => {
|
|
749
760
|
(0, assert_1.default)(!isRootedDiskUri('c:d'));
|
750
761
|
});
|
751
762
|
function getRelativePath(parent, child) {
|
752
|
-
return uri_1.Uri.parse(parent,
|
763
|
+
return uri_1.Uri.parse(parent, caseDetector).getRelativePath(uri_1.Uri.parse(child, caseDetector));
|
753
764
|
}
|
754
765
|
test('getRelativePath', () => {
|
755
766
|
assert_1.default.equal(getRelativePath('/a/b/c', '/a/b/c/d/e/f'), './d/e/f');
|
@@ -759,15 +770,15 @@ test('getRelativePath', () => {
|
|
759
770
|
test('CaseSensitivity', () => {
|
760
771
|
const cwd = '/';
|
761
772
|
const fsCaseInsensitive = new vfs.TestFileSystem(/*ignoreCase*/ true, { cwd });
|
762
|
-
assert_1.default.equal(
|
773
|
+
assert_1.default.equal(fsCaseInsensitive.isLocalFileSystemCaseSensitive(), false);
|
763
774
|
const fsCaseSensitive = new vfs.TestFileSystem(/*ignoreCase*/ false, { cwd });
|
764
|
-
assert_1.default.equal(
|
775
|
+
assert_1.default.equal(fsCaseSensitive.isLocalFileSystemCaseSensitive(), true);
|
765
776
|
});
|
766
777
|
test('deduplicateFolders', () => {
|
767
778
|
const listOfFolders = [
|
768
|
-
['/user', '/user/temp', '/xuser/app', '/lib/python', '/home/p/.venv/lib/site-packages'].map((p) =>
|
769
|
-
['/user', '/user/temp', '/xuser/app', '/lib/python/Python310.zip', '/home/z/.venv/lib/site-packages'].map((p) =>
|
770
|
-
['/main/python/lib/site-packages', '/home/p'].map((p) =>
|
779
|
+
['/user', '/user/temp', '/xuser/app', '/lib/python', '/home/p/.venv/lib/site-packages'].map((p) => uriUtils_1.UriEx.file(p)),
|
780
|
+
['/user', '/user/temp', '/xuser/app', '/lib/python/Python310.zip', '/home/z/.venv/lib/site-packages'].map((p) => uriUtils_1.UriEx.file(p)),
|
781
|
+
['/main/python/lib/site-packages', '/home/p'].map((p) => uriUtils_1.UriEx.file(p)),
|
771
782
|
];
|
772
783
|
const folders = (0, uriUtils_1.deduplicateFolders)(listOfFolders).map((f) => f.getPath());
|
773
784
|
const expected = [
|
@@ -781,7 +792,7 @@ test('deduplicateFolders', () => {
|
|
781
792
|
assert_1.default.deepStrictEqual(folders.sort(), expected.sort());
|
782
793
|
});
|
783
794
|
test('convert UNC path', () => {
|
784
|
-
const path =
|
795
|
+
const path = uriUtils_1.UriEx.file('file:///server/c$/folder/file.py');
|
785
796
|
// When converting UNC path, server part shouldn't be removed.
|
786
797
|
(0, assert_1.default)(path.getPath().indexOf('server') > 0);
|
787
798
|
});
|
@@ -789,9 +800,10 @@ function lowerCaseDrive(entries) {
|
|
789
800
|
return entries.map((p) => (process.platform === 'win32' ? p[0].toLowerCase() + p.slice(1) : p));
|
790
801
|
}
|
791
802
|
test('Realcase', () => {
|
792
|
-
const
|
803
|
+
const tempFile = new realFileSystem_1.RealTempFile();
|
804
|
+
const fs = (0, realFileSystem_1.createFromRealFileSystem)(tempFile);
|
793
805
|
const cwd = process.cwd();
|
794
|
-
const dir = uri_1.Uri.file(path.join(cwd, 'src', 'tests', '..', 'tests'));
|
806
|
+
const dir = uri_1.Uri.file(path.join(cwd, 'src', 'tests', '..', 'tests'), tempFile);
|
795
807
|
const dirFilePath = dir.getFilePath();
|
796
808
|
const entries = nodefs
|
797
809
|
.readdirSync(dirFilePath)
|
@@ -807,17 +819,18 @@ test('Realcase', () => {
|
|
807
819
|
// If windows, check that the case is correct.
|
808
820
|
if (process.platform === 'win32') {
|
809
821
|
for (const p of fspaths) {
|
810
|
-
const upper =
|
822
|
+
const upper = uriUtils_1.UriEx.file(p.toString().toUpperCase());
|
811
823
|
const real = fs.realCasePath(upper);
|
812
824
|
assert_1.default.strictEqual(p, real.getFilePath());
|
813
825
|
}
|
814
826
|
}
|
815
827
|
});
|
816
828
|
test('Realcase use cwd implicitly', () => {
|
817
|
-
const
|
829
|
+
const tempFile = new realFileSystem_1.RealTempFile();
|
830
|
+
const fs = (0, realFileSystem_1.createFromRealFileSystem)(tempFile);
|
818
831
|
const cwd = process.cwd();
|
819
832
|
const dir = path.join(cwd, 'src', 'tests');
|
820
|
-
const uri = uri_1.Uri.file(dir);
|
833
|
+
const uri = uri_1.Uri.file(dir, tempFile);
|
821
834
|
const entries = nodefs.readdirSync(dir).map((entry) => path.basename(nodefs.realpathSync(path.join(dir, entry))));
|
822
835
|
const fsentries = fs.readdirSync(uri);
|
823
836
|
const paths = entries.map((entry) => nodefs.realpathSync(path.join(dir, entry)));
|
@@ -825,10 +838,18 @@ test('Realcase use cwd implicitly', () => {
|
|
825
838
|
assert_1.default.deepStrictEqual(lowerCaseDrive(paths), fspaths);
|
826
839
|
});
|
827
840
|
test('Web URIs dont exist', () => {
|
828
|
-
const
|
829
|
-
const
|
841
|
+
const tempFile = new realFileSystem_1.RealTempFile();
|
842
|
+
const fs = (0, realFileSystem_1.createFromRealFileSystem)(tempFile);
|
843
|
+
const uri = uriUtils_1.UriEx.parse('http://www.bing.com');
|
830
844
|
(0, assert_1.default)(!fs.existsSync(uri));
|
831
845
|
const stat = fs.statSync(uri);
|
832
846
|
(0, assert_1.default)(!stat.isFile());
|
833
847
|
});
|
848
|
+
test('constant uri test', () => {
|
849
|
+
const name = 'constant uri';
|
850
|
+
const uri1 = uri_1.Uri.constant(name);
|
851
|
+
const uri2 = uri_1.Uri.constant(name);
|
852
|
+
(0, assert_1.default)(!uri1.equals(uri2));
|
853
|
+
(0, assert_1.default)(uri1.equals(uri1));
|
854
|
+
});
|
834
855
|
//# sourceMappingURL=uri.test.js.map
|