mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 18:48:33 -05:00
This reverts commit d15a3fcc98.
This commit is contained in:
16
src/vs/base/test/browser/hash.test.ts
Normal file
16
src/vs/base/test/browser/hash.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { createSHA1 } from 'vs/base/browser/hash';
|
||||
|
||||
suite('Hash', () => {
|
||||
test('computeSHA1Hash', async () => {
|
||||
assert.equal(await createSHA1(''), 'da39a3ee5e6b4b0d3255bfef95601890afd80709');
|
||||
assert.equal(await createSHA1('hello world'), '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed');
|
||||
assert.equal(await createSHA1('da39a3ee5e6b4b0d3255bfef95601890afd80709'), '10a34637ad661d98ba3344717656fcc76209c2f8');
|
||||
assert.equal(await createSHA1('2aae6c35c94fcfb415dbe95f408b9ce91ee846ed'), 'd6b0d82cea4269b51572b8fab43adcee9fc3cf9a');
|
||||
assert.equal(await createSHA1('öäü_?ß()<>ÖÄÜ'), 'b64beaeff9e317b0193c8e40a2431b210388eba9');
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { Event, Emitter, EventBufferer, EventMultiplexer, AsyncEmitter, IWaitUntil, PauseableEmitter } from 'vs/base/common/event';
|
||||
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as Errors from 'vs/base/common/errors';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
|
||||
@@ -73,27 +73,6 @@ suite('Event', function () {
|
||||
while (bucket.length) {
|
||||
bucket.pop()!.dispose();
|
||||
}
|
||||
doc.setText('boo');
|
||||
|
||||
// noop
|
||||
subscription.dispose();
|
||||
|
||||
doc.setText('boo');
|
||||
assert.equal(counter.count, 2);
|
||||
});
|
||||
|
||||
test('Emitter, store', function () {
|
||||
|
||||
let bucket = new DisposableStore();
|
||||
let doc = new Samples.Document3();
|
||||
let subscription = doc.onDidChange(counter.onEvent, counter, bucket);
|
||||
|
||||
doc.setText('far');
|
||||
doc.setText('boo');
|
||||
|
||||
// unhook listener
|
||||
bucket.clear();
|
||||
doc.setText('boo');
|
||||
|
||||
// noop
|
||||
subscription.dispose();
|
||||
|
||||
@@ -42,8 +42,7 @@ suite('Lifecycle', () => {
|
||||
assert(!disposable.isDisposed);
|
||||
assert(!disposable2.isDisposed);
|
||||
|
||||
dispose(disposable);
|
||||
dispose(disposable2);
|
||||
dispose(disposable, disposable2);
|
||||
|
||||
assert(disposable.isDisposed);
|
||||
assert(disposable2.isDisposed);
|
||||
|
||||
@@ -63,7 +63,7 @@ suite('URI', () => {
|
||||
assert.equal(URI.from({ scheme: 'http', authority: '', path: 'my/path' }).toString(), 'http:/my/path');
|
||||
assert.equal(URI.from({ scheme: 'http', authority: '', path: '/my/path' }).toString(), 'http:/my/path');
|
||||
//http://a-test-site.com/#test=true
|
||||
assert.equal(URI.from({ scheme: 'http', authority: 'a-test-site.com', path: '/', query: 'test=true' }).toString(), 'http://a-test-site.com/?test=true');
|
||||
assert.equal(URI.from({ scheme: 'http', authority: 'a-test-site.com', path: '/', query: 'test=true' }).toString(), 'http://a-test-site.com/?test%3Dtrue');
|
||||
assert.equal(URI.from({ scheme: 'http', authority: 'a-test-site.com', path: '/', query: '', fragment: 'test=true' }).toString(), 'http://a-test-site.com/#test%3Dtrue');
|
||||
});
|
||||
|
||||
@@ -102,11 +102,11 @@ suite('URI', () => {
|
||||
|
||||
test('with, changes', () => {
|
||||
assert.equal(URI.parse('before:some/file/path').with({ scheme: 'after' }).toString(), 'after:some/file/path');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'http', path: '/api/files/test.me', query: 't=1234' }).toString(), 'http:/api/files/test.me?t=1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'http', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'http:/api/files/test.me?t=1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'https', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'https:/api/files/test.me?t=1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'HTTP', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'HTTP:/api/files/test.me?t=1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'HTTPS', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'HTTPS:/api/files/test.me?t=1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'http', path: '/api/files/test.me', query: 't=1234' }).toString(), 'http:/api/files/test.me?t%3D1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'http', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'http:/api/files/test.me?t%3D1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'https', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'https:/api/files/test.me?t%3D1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'HTTP', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'HTTP:/api/files/test.me?t%3D1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'HTTPS', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'HTTPS:/api/files/test.me?t%3D1234');
|
||||
assert.equal(URI.from({ scheme: 's' }).with({ scheme: 'boo', authority: '', path: '/api/files/test.me', query: 't=1234', fragment: '' }).toString(), 'boo:/api/files/test.me?t%3D1234');
|
||||
});
|
||||
|
||||
@@ -262,11 +262,11 @@ suite('URI', () => {
|
||||
|
||||
value = URI.file('c:\\test with %25\\path');
|
||||
assert.equal(value.path, '/c:/test with %25/path');
|
||||
assert.equal(value.toString(), 'file:///c%3A/test%20with%20%25/path');
|
||||
assert.equal(value.toString(), 'file:///c%3A/test%20with%20%2525/path');
|
||||
|
||||
value = URI.file('c:\\test with %25\\c#code');
|
||||
assert.equal(value.path, '/c:/test with %25/c#code');
|
||||
assert.equal(value.toString(), 'file:///c%3A/test%20with%20%25/c%23code');
|
||||
assert.equal(value.toString(), 'file:///c%3A/test%20with%20%2525/c%23code');
|
||||
|
||||
value = URI.file('\\\\shares');
|
||||
assert.equal(value.scheme, 'file');
|
||||
@@ -376,7 +376,7 @@ suite('URI', () => {
|
||||
let uri = URI.parse('https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.query, 'LinkId=518008');
|
||||
assert.equal(uri.toString(true), 'https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId=518008');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId%3D518008');
|
||||
|
||||
let uri2 = URI.parse(uri.toString());
|
||||
assert.equal(uri2.query, 'LinkId=518008');
|
||||
@@ -385,7 +385,7 @@ suite('URI', () => {
|
||||
uri = URI.parse('https://go.microsoft.com/fwlink/?LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.query, 'LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.toString(true), 'https://go.microsoft.com/fwlink/?LinkId=518008&foö&ké¥=üü');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId=518008&fo%C3%B6&k%C3%A9%C2%A5=%C3%BC%C3%BC');
|
||||
assert.equal(uri.toString(), 'https://go.microsoft.com/fwlink/?LinkId%3D518008%26fo%C3%B6%26k%C3%A9%C2%A5%3D%C3%BC%C3%BC');
|
||||
|
||||
uri2 = URI.parse(uri.toString());
|
||||
assert.equal(uri2.query, 'LinkId=518008&foö&ké¥=üü');
|
||||
@@ -426,57 +426,6 @@ suite('URI', () => {
|
||||
assert.equal(uri.toString(true), input);
|
||||
});
|
||||
|
||||
test('Support URL specific encodings (query component) #25852', function () {
|
||||
let input = 'http://example.com/over/there?name=ferret';
|
||||
assert.equal(input, URI.parse(input).toString());
|
||||
|
||||
input = 'http://example.com/over/there?name=ferret&foo=bar';
|
||||
assert.equal(input, URI.parse(input).toString());
|
||||
|
||||
input = 'attp://example.com/over/there?name=ferret';
|
||||
assert.equal('attp://example.com/over/there?name%3Dferret', URI.parse(input).toString());
|
||||
});
|
||||
|
||||
test('Uri#parse can break path-component #45515', function () {
|
||||
let uri: URI;
|
||||
uri = URI.from({ scheme: 's', authority: 'a', path: '/o%2f' });
|
||||
assert.equal(uri.toString(), 's://a/o%2f');
|
||||
uri = URI.from({ scheme: 's', authority: 'a', path: '/o%2fü' });
|
||||
assert.equal(uri.toString(), 's://a/o%2f%C3%BC');
|
||||
uri = URI.from({ scheme: 's', authority: 'a', path: '/o%2f%' });
|
||||
assert.equal(uri.toString(), 's://a/o%2f%25');
|
||||
|
||||
uri = URI.file('/test with %25/c#code');
|
||||
assert.equal(uri.path, '/test with %25/c#code');
|
||||
assert.equal(uri.toString(), 'file:///test%20with%20%25/c%23code');
|
||||
|
||||
uri = URI.from({
|
||||
scheme: 'http',
|
||||
authority: 'a',
|
||||
path: '/o/products%2FzVNZkudXJyq8bPGTXUxx%2FBetterave-Sesame.jpg'
|
||||
});
|
||||
assert.equal(uri.path, '/o/products%2FzVNZkudXJyq8bPGTXUxx%2FBetterave-Sesame.jpg');
|
||||
assert.equal(uri.toString(), 'http://a/o/products%2FzVNZkudXJyq8bPGTXUxx%2FBetterave-Sesame.jpg');
|
||||
|
||||
assert.equal(URI.parse(uri.toString()).path, '/o/products%2FzVNZkudXJyq8bPGTXUxx%2FBetterave-Sesame.jpg');
|
||||
assert.equal(uri.toString(), URI.parse(uri.toString()).toString()); // identity
|
||||
|
||||
uri = URI.parse('s://a/p%2ft%c3%bc');
|
||||
assert.equal(uri.path, '/p%2ftü');
|
||||
|
||||
uri = URI.parse('s://a/%c3%bcp%2f-REST');
|
||||
assert.equal(uri.path, '/üp%2f-REST');
|
||||
|
||||
uri = URI.parse('s://a/%c3%bcp%2fd%c3%b6wn');
|
||||
assert.equal(uri.path, '/üp%2fdöwn');
|
||||
|
||||
//https://github.com/microsoft/vscode/issues/25852
|
||||
uri = URI.parse('http://www.test.com/path/service?authId=CN%3DQ10');
|
||||
assert.equal(uri.query, 'authId=CN%3DQ10');
|
||||
assert.equal(uri.toString(), 'http://www.test.com/path/service?authId=CN%3DQ10');
|
||||
});
|
||||
|
||||
|
||||
test('URI - (de)serialize', function () {
|
||||
|
||||
const values = [
|
||||
|
||||
Reference in New Issue
Block a user