mirror of
https://github.com/coder/code-server.git
synced 2026-05-14 16:27:27 +02:00
chore(vscode): update to 1.53.2
These conflicts will be resolved in the following commits. We do it this way so that PR review is possible.
This commit is contained in:
@@ -11,39 +11,37 @@ import { CharCode } from 'vs/base/common/charCode';
|
||||
suite('Paths', () => {
|
||||
|
||||
test('toForwardSlashes', () => {
|
||||
assert.equal(extpath.toSlashes('\\\\server\\share\\some\\path'), '//server/share/some/path');
|
||||
assert.equal(extpath.toSlashes('c:\\test'), 'c:/test');
|
||||
assert.equal(extpath.toSlashes('foo\\bar'), 'foo/bar');
|
||||
assert.equal(extpath.toSlashes('/user/far'), '/user/far');
|
||||
assert.strictEqual(extpath.toSlashes('\\\\server\\share\\some\\path'), '//server/share/some/path');
|
||||
assert.strictEqual(extpath.toSlashes('c:\\test'), 'c:/test');
|
||||
assert.strictEqual(extpath.toSlashes('foo\\bar'), 'foo/bar');
|
||||
assert.strictEqual(extpath.toSlashes('/user/far'), '/user/far');
|
||||
});
|
||||
|
||||
test('getRoot', () => {
|
||||
assert.equal(extpath.getRoot('/user/far'), '/');
|
||||
assert.equal(extpath.getRoot('\\\\server\\share\\some\\path'), '//server/share/');
|
||||
assert.equal(extpath.getRoot('//server/share/some/path'), '//server/share/');
|
||||
assert.equal(extpath.getRoot('//server/share'), '/');
|
||||
assert.equal(extpath.getRoot('//server'), '/');
|
||||
assert.equal(extpath.getRoot('//server//'), '/');
|
||||
assert.equal(extpath.getRoot('c:/user/far'), 'c:/');
|
||||
assert.equal(extpath.getRoot('c:user/far'), 'c:');
|
||||
assert.equal(extpath.getRoot('http://www'), '');
|
||||
assert.equal(extpath.getRoot('http://www/'), 'http://www/');
|
||||
assert.equal(extpath.getRoot('file:///foo'), 'file:///');
|
||||
assert.equal(extpath.getRoot('file://foo'), '');
|
||||
assert.strictEqual(extpath.getRoot('/user/far'), '/');
|
||||
assert.strictEqual(extpath.getRoot('\\\\server\\share\\some\\path'), '//server/share/');
|
||||
assert.strictEqual(extpath.getRoot('//server/share/some/path'), '//server/share/');
|
||||
assert.strictEqual(extpath.getRoot('//server/share'), '/');
|
||||
assert.strictEqual(extpath.getRoot('//server'), '/');
|
||||
assert.strictEqual(extpath.getRoot('//server//'), '/');
|
||||
assert.strictEqual(extpath.getRoot('c:/user/far'), 'c:/');
|
||||
assert.strictEqual(extpath.getRoot('c:user/far'), 'c:');
|
||||
assert.strictEqual(extpath.getRoot('http://www'), '');
|
||||
assert.strictEqual(extpath.getRoot('http://www/'), 'http://www/');
|
||||
assert.strictEqual(extpath.getRoot('file:///foo'), 'file:///');
|
||||
assert.strictEqual(extpath.getRoot('file://foo'), '');
|
||||
});
|
||||
|
||||
test('isUNC', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.ok(!extpath.isUNC('foo'));
|
||||
assert.ok(!extpath.isUNC('/foo'));
|
||||
assert.ok(!extpath.isUNC('\\foo'));
|
||||
assert.ok(!extpath.isUNC('\\\\foo'));
|
||||
assert.ok(extpath.isUNC('\\\\a\\b'));
|
||||
assert.ok(!extpath.isUNC('//a/b'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share\\'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share\\path'));
|
||||
}
|
||||
(!platform.isWindows ? test.skip : test)('isUNC', () => {
|
||||
assert.ok(!extpath.isUNC('foo'));
|
||||
assert.ok(!extpath.isUNC('/foo'));
|
||||
assert.ok(!extpath.isUNC('\\foo'));
|
||||
assert.ok(!extpath.isUNC('\\\\foo'));
|
||||
assert.ok(extpath.isUNC('\\\\a\\b'));
|
||||
assert.ok(!extpath.isUNC('//a/b'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share\\'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share\\path'));
|
||||
});
|
||||
|
||||
test('isValidBasename', () => {
|
||||
@@ -75,41 +73,41 @@ suite('Paths', () => {
|
||||
|
||||
test('sanitizeFilePath', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.equal(extpath.sanitizeFilePath('.', 'C:\\the\\cwd'), 'C:\\the\\cwd');
|
||||
assert.equal(extpath.sanitizeFilePath('', 'C:\\the\\cwd'), 'C:\\the\\cwd');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('.', 'C:\\the\\cwd'), 'C:\\the\\cwd');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('', 'C:\\the\\cwd'), 'C:\\the\\cwd');
|
||||
|
||||
assert.equal(extpath.sanitizeFilePath('C:', 'C:\\the\\cwd'), 'C:\\');
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\', 'C:\\the\\cwd'), 'C:\\');
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\\\', 'C:\\the\\cwd'), 'C:\\');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:', 'C:\\the\\cwd'), 'C:\\');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\', 'C:\\the\\cwd'), 'C:\\');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\\\', 'C:\\the\\cwd'), 'C:\\');
|
||||
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\folder\\my.txt', 'C:\\the\\cwd'), 'C:\\folder\\my.txt');
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\folder\\my', 'C:\\the\\cwd'), 'C:\\folder\\my');
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\folder\\..\\my', 'C:\\the\\cwd'), 'C:\\my');
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\folder\\my\\', 'C:\\the\\cwd'), 'C:\\folder\\my');
|
||||
assert.equal(extpath.sanitizeFilePath('C:\\folder\\my\\\\\\', 'C:\\the\\cwd'), 'C:\\folder\\my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\folder\\my.txt', 'C:\\the\\cwd'), 'C:\\folder\\my.txt');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\folder\\my', 'C:\\the\\cwd'), 'C:\\folder\\my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\folder\\..\\my', 'C:\\the\\cwd'), 'C:\\my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\folder\\my\\', 'C:\\the\\cwd'), 'C:\\folder\\my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('C:\\folder\\my\\\\\\', 'C:\\the\\cwd'), 'C:\\folder\\my');
|
||||
|
||||
assert.equal(extpath.sanitizeFilePath('my.txt', 'C:\\the\\cwd'), 'C:\\the\\cwd\\my.txt');
|
||||
assert.equal(extpath.sanitizeFilePath('my.txt\\', 'C:\\the\\cwd'), 'C:\\the\\cwd\\my.txt');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('my.txt', 'C:\\the\\cwd'), 'C:\\the\\cwd\\my.txt');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('my.txt\\', 'C:\\the\\cwd'), 'C:\\the\\cwd\\my.txt');
|
||||
|
||||
assert.equal(extpath.sanitizeFilePath('\\\\localhost\\folder\\my', 'C:\\the\\cwd'), '\\\\localhost\\folder\\my');
|
||||
assert.equal(extpath.sanitizeFilePath('\\\\localhost\\folder\\my\\', 'C:\\the\\cwd'), '\\\\localhost\\folder\\my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('\\\\localhost\\folder\\my', 'C:\\the\\cwd'), '\\\\localhost\\folder\\my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('\\\\localhost\\folder\\my\\', 'C:\\the\\cwd'), '\\\\localhost\\folder\\my');
|
||||
} else {
|
||||
assert.equal(extpath.sanitizeFilePath('.', '/the/cwd'), '/the/cwd');
|
||||
assert.equal(extpath.sanitizeFilePath('', '/the/cwd'), '/the/cwd');
|
||||
assert.equal(extpath.sanitizeFilePath('/', '/the/cwd'), '/');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('.', '/the/cwd'), '/the/cwd');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('', '/the/cwd'), '/the/cwd');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('/', '/the/cwd'), '/');
|
||||
|
||||
assert.equal(extpath.sanitizeFilePath('/folder/my.txt', '/the/cwd'), '/folder/my.txt');
|
||||
assert.equal(extpath.sanitizeFilePath('/folder/my', '/the/cwd'), '/folder/my');
|
||||
assert.equal(extpath.sanitizeFilePath('/folder/../my', '/the/cwd'), '/my');
|
||||
assert.equal(extpath.sanitizeFilePath('/folder/my/', '/the/cwd'), '/folder/my');
|
||||
assert.equal(extpath.sanitizeFilePath('/folder/my///', '/the/cwd'), '/folder/my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('/folder/my.txt', '/the/cwd'), '/folder/my.txt');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('/folder/my', '/the/cwd'), '/folder/my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('/folder/../my', '/the/cwd'), '/my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('/folder/my/', '/the/cwd'), '/folder/my');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('/folder/my///', '/the/cwd'), '/folder/my');
|
||||
|
||||
assert.equal(extpath.sanitizeFilePath('my.txt', '/the/cwd'), '/the/cwd/my.txt');
|
||||
assert.equal(extpath.sanitizeFilePath('my.txt/', '/the/cwd'), '/the/cwd/my.txt');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('my.txt', '/the/cwd'), '/the/cwd/my.txt');
|
||||
assert.strictEqual(extpath.sanitizeFilePath('my.txt/', '/the/cwd'), '/the/cwd/my.txt');
|
||||
}
|
||||
});
|
||||
|
||||
test('isRoot', () => {
|
||||
test('isRootOrDriveLetter', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.ok(extpath.isRootOrDriveLetter('c:'));
|
||||
assert.ok(extpath.isRootOrDriveLetter('D:'));
|
||||
@@ -123,6 +121,34 @@ suite('Paths', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('hasDriveLetter', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.ok(extpath.hasDriveLetter('c:'));
|
||||
assert.ok(extpath.hasDriveLetter('D:'));
|
||||
assert.ok(extpath.hasDriveLetter('D:/'));
|
||||
assert.ok(extpath.hasDriveLetter('D:\\'));
|
||||
assert.ok(extpath.hasDriveLetter('D:\\path'));
|
||||
assert.ok(extpath.hasDriveLetter('D:/path'));
|
||||
} else {
|
||||
assert.ok(!extpath.hasDriveLetter('/'));
|
||||
assert.ok(!extpath.hasDriveLetter('/path'));
|
||||
}
|
||||
});
|
||||
|
||||
test('getDriveLetter', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.strictEqual(extpath.getDriveLetter('c:'), 'c');
|
||||
assert.strictEqual(extpath.getDriveLetter('D:'), 'D');
|
||||
assert.strictEqual(extpath.getDriveLetter('D:/'), 'D');
|
||||
assert.strictEqual(extpath.getDriveLetter('D:\\'), 'D');
|
||||
assert.strictEqual(extpath.getDriveLetter('D:\\path'), 'D');
|
||||
assert.strictEqual(extpath.getDriveLetter('D:/path'), 'D');
|
||||
} else {
|
||||
assert.ok(!extpath.getDriveLetter('/'));
|
||||
assert.ok(!extpath.getDriveLetter('/path'));
|
||||
}
|
||||
});
|
||||
|
||||
test('isWindowsDriveLetter', () => {
|
||||
assert.ok(!extpath.isWindowsDriveLetter(0));
|
||||
assert.ok(!extpath.isWindowsDriveLetter(-1));
|
||||
@@ -131,47 +157,47 @@ suite('Paths', () => {
|
||||
});
|
||||
|
||||
test('indexOfPath', () => {
|
||||
assert.equal(extpath.indexOfPath('/foo', '/bar', true), -1);
|
||||
assert.equal(extpath.indexOfPath('/foo', '/FOO', false), -1);
|
||||
assert.equal(extpath.indexOfPath('/foo', '/FOO', true), 0);
|
||||
assert.equal(extpath.indexOfPath('/some/long/path', '/some/long', false), 0);
|
||||
assert.equal(extpath.indexOfPath('/some/long/path', '/PATH', true), 10);
|
||||
assert.strictEqual(extpath.indexOfPath('/foo', '/bar', true), -1);
|
||||
assert.strictEqual(extpath.indexOfPath('/foo', '/FOO', false), -1);
|
||||
assert.strictEqual(extpath.indexOfPath('/foo', '/FOO', true), 0);
|
||||
assert.strictEqual(extpath.indexOfPath('/some/long/path', '/some/long', false), 0);
|
||||
assert.strictEqual(extpath.indexOfPath('/some/long/path', '/PATH', true), 10);
|
||||
});
|
||||
|
||||
test('parseLineAndColumnAware', () => {
|
||||
let res = extpath.parseLineAndColumnAware('/foo/bar');
|
||||
assert.equal(res.path, '/foo/bar');
|
||||
assert.equal(res.line, undefined);
|
||||
assert.equal(res.column, undefined);
|
||||
assert.strictEqual(res.path, '/foo/bar');
|
||||
assert.strictEqual(res.line, undefined);
|
||||
assert.strictEqual(res.column, undefined);
|
||||
|
||||
res = extpath.parseLineAndColumnAware('/foo/bar:33');
|
||||
assert.equal(res.path, '/foo/bar');
|
||||
assert.equal(res.line, 33);
|
||||
assert.equal(res.column, 1);
|
||||
assert.strictEqual(res.path, '/foo/bar');
|
||||
assert.strictEqual(res.line, 33);
|
||||
assert.strictEqual(res.column, 1);
|
||||
|
||||
res = extpath.parseLineAndColumnAware('/foo/bar:33:34');
|
||||
assert.equal(res.path, '/foo/bar');
|
||||
assert.equal(res.line, 33);
|
||||
assert.equal(res.column, 34);
|
||||
assert.strictEqual(res.path, '/foo/bar');
|
||||
assert.strictEqual(res.line, 33);
|
||||
assert.strictEqual(res.column, 34);
|
||||
|
||||
res = extpath.parseLineAndColumnAware('C:\\foo\\bar');
|
||||
assert.equal(res.path, 'C:\\foo\\bar');
|
||||
assert.equal(res.line, undefined);
|
||||
assert.equal(res.column, undefined);
|
||||
assert.strictEqual(res.path, 'C:\\foo\\bar');
|
||||
assert.strictEqual(res.line, undefined);
|
||||
assert.strictEqual(res.column, undefined);
|
||||
|
||||
res = extpath.parseLineAndColumnAware('C:\\foo\\bar:33');
|
||||
assert.equal(res.path, 'C:\\foo\\bar');
|
||||
assert.equal(res.line, 33);
|
||||
assert.equal(res.column, 1);
|
||||
assert.strictEqual(res.path, 'C:\\foo\\bar');
|
||||
assert.strictEqual(res.line, 33);
|
||||
assert.strictEqual(res.column, 1);
|
||||
|
||||
res = extpath.parseLineAndColumnAware('C:\\foo\\bar:33:34');
|
||||
assert.equal(res.path, 'C:\\foo\\bar');
|
||||
assert.equal(res.line, 33);
|
||||
assert.equal(res.column, 34);
|
||||
assert.strictEqual(res.path, 'C:\\foo\\bar');
|
||||
assert.strictEqual(res.line, 33);
|
||||
assert.strictEqual(res.column, 34);
|
||||
|
||||
res = extpath.parseLineAndColumnAware('/foo/bar:abb');
|
||||
assert.equal(res.path, '/foo/bar:abb');
|
||||
assert.equal(res.line, undefined);
|
||||
assert.equal(res.column, undefined);
|
||||
assert.strictEqual(res.path, '/foo/bar:abb');
|
||||
assert.strictEqual(res.line, undefined);
|
||||
assert.strictEqual(res.column, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user