Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3

This commit is contained in:
ADS Merger
2020-03-11 04:19:23 +00:00
parent 16fab722d5
commit 4c3e48773d
880 changed files with 20441 additions and 11232 deletions

View File

@@ -7,7 +7,7 @@ import * as assert from 'assert';
import { tmpdir } from 'os';
import { FileService } from 'vs/platform/files/common/fileService';
import { Schemas } from 'vs/base/common/network';
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider';
import { getRandomTestPath } from 'vs/base/test/node/testUtils';
import { generateUuid } from 'vs/base/common/uuid';
import { join, basename, dirname, posix } from 'vs/base/common/path';
@@ -67,6 +67,7 @@ export class TestDiskFileSystemProvider extends DiskFileSystemProvider {
FileSystemProviderCapabilities.FileReadWrite |
FileSystemProviderCapabilities.FileOpenReadWriteClose |
FileSystemProviderCapabilities.FileReadStream |
FileSystemProviderCapabilities.Trash |
FileSystemProviderCapabilities.FileFolderCopy;
if (isLinux) {
@@ -131,10 +132,12 @@ suite('Disk File Service', function () {
const disposables = new DisposableStore();
// Given issues such as https://github.com/microsoft/vscode/issues/78602
// we see random test failures when accessing the native file system. To
// diagnose further, we retry node.js file access tests up to 3 times to
// rule out any random disk issue.
// and https://github.com/microsoft/vscode/issues/92334 we see random test
// failures when accessing the native file system. To diagnose further, we
// retry node.js file access tests up to 3 times to rule out any random disk
// issue and increase the timeout.
this.retries(3);
this.timeout(1000 * 10);
setup(async () => {
const logService = new NullLogService();
@@ -459,13 +462,21 @@ suite('Disk File Service', function () {
});
test('deleteFile', async () => {
return testDeleteFile(false);
});
(isLinux /* trash is unreliable on Linux */ ? test.skip : test)('deleteFile (useTrash)', async () => {
return testDeleteFile(true);
});
async function testDeleteFile(useTrash: boolean): Promise<void> {
let event: FileOperationEvent;
disposables.add(service.onDidRunOperation(e => event = e));
const resource = URI.file(join(testDir, 'deep', 'conway.js'));
const source = await service.resolve(resource);
await service.del(source.resource);
await service.del(source.resource, { useTrash });
assert.equal(existsSync(source.resource.fsPath), false);
@@ -475,14 +486,14 @@ suite('Disk File Service', function () {
let error: Error | undefined = undefined;
try {
await service.del(source.resource);
await service.del(source.resource, { useTrash });
} catch (e) {
error = e;
}
assert.ok(error);
assert.equal((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_NOT_FOUND);
});
}
test('deleteFile - symbolic link (exists)', async () => {
if (isWindows) {
@@ -531,19 +542,27 @@ suite('Disk File Service', function () {
});
test('deleteFolder (recursive)', async () => {
return testDeleteFolderRecursive(false);
});
(isLinux /* trash is unreliable on Linux */ ? test.skip : test)('deleteFolder (recursive, useTrash)', async () => {
return testDeleteFolderRecursive(true);
});
async function testDeleteFolderRecursive(useTrash: boolean): Promise<void> {
let event: FileOperationEvent;
disposables.add(service.onDidRunOperation(e => event = e));
const resource = URI.file(join(testDir, 'deep'));
const source = await service.resolve(resource);
await service.del(source.resource, { recursive: true });
await service.del(source.resource, { recursive: true, useTrash });
assert.equal(existsSync(source.resource.fsPath), false);
assert.ok(event!);
assert.equal(event!.resource.fsPath, resource.fsPath);
assert.equal(event!.operation, FileOperation.DELETE);
});
}
test('deleteFolder (non recursive)', async () => {
const resource = URI.file(join(testDir, 'deep'));

View File

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B