提交 b5701779 编写于 作者: B Benjamin Pasero

debt - adopt some strictEqual in tests

上级 f123c904
......@@ -47,10 +47,10 @@ suite('IPC, MessagePorts', () => {
});
const channelClient1 = client2.getChannel('client1');
assert.equal(await channelClient1.call('testMethodClient1'), 'success1');
assert.strictEqual(await channelClient1.call('testMethodClient1'), 'success1');
const channelClient2 = client1.getChannel('client2');
assert.equal(await channelClient2.call('testMethodClient2'), 'success2');
assert.strictEqual(await channelClient2.call('testMethodClient2'), 'success2');
client1.dispose();
client2.dispose();
......
......@@ -7,7 +7,7 @@ import { SQLiteStorageDatabase, ISQLiteStorageDatabaseOptions } from 'vs/base/pa
import { Storage, IStorageDatabase, IStorageItemsChangeEvent } from 'vs/base/parts/storage/common/storage';
import { join } from 'vs/base/common/path';
import { tmpdir } from 'os';
import { equal, ok } from 'assert';
import { strictEqual, ok } from 'assert';
import { mkdirp, writeFile, exists, unlink, rimraf } from 'vs/base/node/pfs';
import { timeout } from 'vs/base/common/async';
import { Event, Emitter } from 'vs/base/common/event';
......@@ -35,9 +35,9 @@ flakySuite('Storage Library', function () {
await storage.init();
// Empty fallbacks
equal(storage.get('foo', 'bar'), 'bar');
equal(storage.getNumber('foo', 55), 55);
equal(storage.getBoolean('foo', true), true);
strictEqual(storage.get('foo', 'bar'), 'bar');
strictEqual(storage.getNumber('foo', 55), 55);
strictEqual(storage.getBoolean('foo', true), true);
let changes = new Set<string>();
storage.onDidChangeStorage(key => {
......@@ -54,19 +54,19 @@ flakySuite('Storage Library', function () {
let flushPromiseResolved = false;
storage.whenFlushed().then(() => flushPromiseResolved = true);
equal(storage.get('bar'), 'foo');
equal(storage.getNumber('barNumber'), 55);
equal(storage.getBoolean('barBoolean'), true);
strictEqual(storage.get('bar'), 'foo');
strictEqual(storage.getNumber('barNumber'), 55);
strictEqual(storage.getBoolean('barBoolean'), true);
equal(changes.size, 3);
strictEqual(changes.size, 3);
ok(changes.has('bar'));
ok(changes.has('barNumber'));
ok(changes.has('barBoolean'));
let setPromiseResolved = false;
await Promise.all([set1Promise, set2Promise, set3Promise]).then(() => setPromiseResolved = true);
equal(setPromiseResolved, true);
equal(flushPromiseResolved, true);
strictEqual(setPromiseResolved, true);
strictEqual(flushPromiseResolved, true);
changes = new Set<string>();
......@@ -74,7 +74,7 @@ flakySuite('Storage Library', function () {
storage.set('bar', 'foo');
storage.set('barNumber', 55);
storage.set('barBoolean', true);
equal(changes.size, 0);
strictEqual(changes.size, 0);
// Simple deletes
const delete1Promise = storage.delete('bar');
......@@ -85,7 +85,7 @@ flakySuite('Storage Library', function () {
ok(!storage.getNumber('barNumber'));
ok(!storage.getBoolean('barBoolean'));
equal(changes.size, 3);
strictEqual(changes.size, 3);
ok(changes.has('bar'));
ok(changes.has('barNumber'));
ok(changes.has('barBoolean'));
......@@ -96,11 +96,11 @@ flakySuite('Storage Library', function () {
storage.delete('bar');
storage.delete('barNumber');
storage.delete('barBoolean');
equal(changes.size, 0);
strictEqual(changes.size, 0);
let deletePromiseResolved = false;
await Promise.all([delete1Promise, delete2Promise, delete3Promise]).then(() => deletePromiseResolved = true);
equal(deletePromiseResolved, true);
strictEqual(deletePromiseResolved, true);
await storage.close();
});
......@@ -134,25 +134,25 @@ flakySuite('Storage Library', function () {
const changed = new Map<string, string>();
changed.set('foo', 'bar');
database.fireDidChangeItemsExternal({ changed });
equal(changes.size, 0);
strictEqual(changes.size, 0);
// Change is accepted if valid
changed.set('foo', 'bar1');
database.fireDidChangeItemsExternal({ changed });
ok(changes.has('foo'));
equal(storage.get('foo'), 'bar1');
strictEqual(storage.get('foo'), 'bar1');
changes.clear();
// Delete is accepted
const deleted = new Set<string>(['foo']);
database.fireDidChangeItemsExternal({ deleted });
ok(changes.has('foo'));
equal(storage.get('foo', undefined), undefined);
strictEqual(storage.get('foo', undefined), undefined);
changes.clear();
// Nothing happens if changing to same value
database.fireDidChangeItemsExternal({ deleted });
equal(changes.size, 0);
strictEqual(changes.size, 0);
await storage.close();
});
......@@ -167,22 +167,22 @@ flakySuite('Storage Library', function () {
let flushPromiseResolved = false;
storage.whenFlushed().then(() => flushPromiseResolved = true);
equal(storage.get('foo'), 'bar');
equal(storage.get('bar'), 'foo');
strictEqual(storage.get('foo'), 'bar');
strictEqual(storage.get('bar'), 'foo');
let setPromiseResolved = false;
Promise.all([set1Promise, set2Promise]).then(() => setPromiseResolved = true);
await storage.close();
equal(setPromiseResolved, true);
equal(flushPromiseResolved, true);
strictEqual(setPromiseResolved, true);
strictEqual(flushPromiseResolved, true);
storage = new Storage(new SQLiteStorageDatabase(join(storageDir, 'storage.db')));
await storage.init();
equal(storage.get('foo'), 'bar');
equal(storage.get('bar'), 'foo');
strictEqual(storage.get('foo'), 'bar');
strictEqual(storage.get('bar'), 'foo');
await storage.close();
......@@ -200,7 +200,7 @@ flakySuite('Storage Library', function () {
await storage.close();
equal(deletePromiseResolved, true);
strictEqual(deletePromiseResolved, true);
storage = new Storage(new SQLiteStorageDatabase(join(storageDir, 'storage.db')));
await storage.init();
......@@ -227,8 +227,8 @@ flakySuite('Storage Library', function () {
let flushPromiseResolved = false;
storage.whenFlushed().then(() => flushPromiseResolved = true);
equal(storage.get('foo'), 'bar3');
equal(changes.size, 1);
strictEqual(storage.get('foo'), 'bar3');
strictEqual(changes.size, 1);
ok(changes.has('foo'));
let setPromiseResolved = false;
......@@ -243,7 +243,7 @@ flakySuite('Storage Library', function () {
ok(!storage.get('bar'));
equal(changes.size, 1);
strictEqual(changes.size, 1);
ok(changes.has('bar'));
let setAndDeletePromiseResolved = false;
......@@ -265,16 +265,16 @@ flakySuite('Storage Library', function () {
await storage.set('foo', 'bar');
equal(storage.get('bar'), 'foo');
equal(storage.get('foo'), 'bar');
strictEqual(storage.get('bar'), 'foo');
strictEqual(storage.get('foo'), 'bar');
await storage.close();
storage = new Storage(new SQLiteStorageDatabase(storageFile));
await storage.init();
equal(storage.get('bar'), 'foo');
equal(storage.get('foo'), 'bar');
strictEqual(storage.get('bar'), 'foo');
strictEqual(storage.get('foo'), 'bar');
await storage.close();
});
......@@ -319,49 +319,49 @@ flakySuite('SQLite Storage Library', function () {
items.set(JSON.stringify({ foo: 'bar' }), JSON.stringify({ bar: 'foo' }));
let storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await storage.updateItems({ insert: items });
storedItems = await storage.getItems();
equal(storedItems.size, items.size);
equal(storedItems.get('foo'), 'bar');
equal(storedItems.get('some/foo/path'), 'some/bar/path');
equal(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
strictEqual(storedItems.size, items.size);
strictEqual(storedItems.get('foo'), 'bar');
strictEqual(storedItems.get('some/foo/path'), 'some/bar/path');
strictEqual(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
await storage.updateItems({ delete: toSet(['foo']) });
storedItems = await storage.getItems();
equal(storedItems.size, items.size - 1);
strictEqual(storedItems.size, items.size - 1);
ok(!storedItems.has('foo'));
equal(storedItems.get('some/foo/path'), 'some/bar/path');
equal(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
strictEqual(storedItems.get('some/foo/path'), 'some/bar/path');
strictEqual(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
await storage.updateItems({ insert: items });
storedItems = await storage.getItems();
equal(storedItems.size, items.size);
equal(storedItems.get('foo'), 'bar');
equal(storedItems.get('some/foo/path'), 'some/bar/path');
equal(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
strictEqual(storedItems.size, items.size);
strictEqual(storedItems.get('foo'), 'bar');
strictEqual(storedItems.get('some/foo/path'), 'some/bar/path');
strictEqual(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
const itemsChange = new Map<string, string>();
itemsChange.set('foo', 'otherbar');
await storage.updateItems({ insert: itemsChange });
storedItems = await storage.getItems();
equal(storedItems.get('foo'), 'otherbar');
strictEqual(storedItems.get('foo'), 'otherbar');
await storage.updateItems({ delete: toSet(['foo', 'bar', 'some/foo/path', JSON.stringify({ foo: 'bar' })]) });
storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await storage.updateItems({ insert: items, delete: toSet(['foo', 'some/foo/path', 'other']) });
storedItems = await storage.getItems();
equal(storedItems.size, 1);
equal(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
strictEqual(storedItems.size, 1);
strictEqual(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
await storage.updateItems({ delete: toSet([JSON.stringify({ foo: 'bar' })]) });
storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
let recoveryCalled = false;
await storage.close(() => {
......@@ -370,7 +370,7 @@ flakySuite('SQLite Storage Library', function () {
return new Map();
});
equal(recoveryCalled, false);
strictEqual(recoveryCalled, false);
}
test('basics', async () => {
......@@ -411,10 +411,10 @@ flakySuite('SQLite Storage Library', function () {
storage = new SQLiteStorageDatabase(storagePath);
const storedItems = await storage.getItems();
equal(storedItems.size, items.size);
equal(storedItems.get('foo'), 'bar');
equal(storedItems.get('some/foo/path'), 'some/bar/path');
equal(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
strictEqual(storedItems.size, items.size);
strictEqual(storedItems.get('foo'), 'bar');
strictEqual(storedItems.get('some/foo/path'), 'some/bar/path');
strictEqual(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
let recoveryCalled = false;
await storage.close(() => {
......@@ -423,7 +423,7 @@ flakySuite('SQLite Storage Library', function () {
return new Map();
});
equal(recoveryCalled, false);
strictEqual(recoveryCalled, false);
});
test('basics (corrupt DB falls back to empty DB if backup is corrupt)', async () => {
......@@ -444,7 +444,7 @@ flakySuite('SQLite Storage Library', function () {
storage = new SQLiteStorageDatabase(storagePath);
const storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await testDBBasics(storagePath);
});
......@@ -462,7 +462,7 @@ flakySuite('SQLite Storage Library', function () {
await storage.close();
const backupPath = `${storagePath}.backup`;
equal(await exists(backupPath), true);
strictEqual(await exists(backupPath), true);
storage = new SQLiteStorageDatabase(storagePath);
await storage.getItems();
......@@ -484,16 +484,16 @@ flakySuite('SQLite Storage Library', function () {
return items;
});
equal(recoveryCalled, true);
equal(await exists(backupPath), true);
strictEqual(recoveryCalled, true);
strictEqual(await exists(backupPath), true);
storage = new SQLiteStorageDatabase(storagePath);
const storedItems = await storage.getItems();
equal(storedItems.size, items.size);
equal(storedItems.get('foo'), 'bar');
equal(storedItems.get('some/foo/path'), 'some/bar/path');
equal(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
strictEqual(storedItems.size, items.size);
strictEqual(storedItems.get('foo'), 'bar');
strictEqual(storedItems.get('some/foo/path'), 'some/bar/path');
strictEqual(storedItems.get(JSON.stringify({ foo: 'bar' })), JSON.stringify({ bar: 'foo' }));
recoveryCalled = false;
await storage.close(() => {
......@@ -502,7 +502,7 @@ flakySuite('SQLite Storage Library', function () {
return new Map();
});
equal(recoveryCalled, false);
strictEqual(recoveryCalled, false);
});
test('real world example', async function () {
......@@ -525,7 +525,7 @@ flakySuite('SQLite Storage Library', function () {
items3.set('very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.very.long.key.', 'is long');
let storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await Promise.all([
await storage.updateItems({ insert: items1 }),
......@@ -533,28 +533,28 @@ flakySuite('SQLite Storage Library', function () {
await storage.updateItems({ insert: items3 })
]);
equal(await storage.checkIntegrity(true), 'ok');
equal(await storage.checkIntegrity(false), 'ok');
strictEqual(await storage.checkIntegrity(true), 'ok');
strictEqual(await storage.checkIntegrity(false), 'ok');
storedItems = await storage.getItems();
equal(storedItems.size, items1.size + items2.size + items3.size);
strictEqual(storedItems.size, items1.size + items2.size + items3.size);
const items1Keys: string[] = [];
items1.forEach((value, key) => {
items1Keys.push(key);
equal(storedItems.get(key), value);
strictEqual(storedItems.get(key), value);
});
const items2Keys: string[] = [];
items2.forEach((value, key) => {
items2Keys.push(key);
equal(storedItems.get(key), value);
strictEqual(storedItems.get(key), value);
});
const items3Keys: string[] = [];
items3.forEach((value, key) => {
items3Keys.push(key);
equal(storedItems.get(key), value);
strictEqual(storedItems.get(key), value);
});
await Promise.all([
......@@ -564,7 +564,7 @@ flakySuite('SQLite Storage Library', function () {
]);
storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await Promise.all([
await storage.updateItems({ insert: items1 }),
......@@ -576,14 +576,14 @@ flakySuite('SQLite Storage Library', function () {
]);
storedItems = await storage.getItems();
equal(storedItems.size, items1.size + items2.size + items3.size);
strictEqual(storedItems.size, items1.size + items2.size + items3.size);
await storage.close();
storage = new SQLiteStorageDatabase(join(storageDir, 'storage.db'));
storedItems = await storage.getItems();
equal(storedItems.size, items1.size + items2.size + items3.size);
strictEqual(storedItems.size, items1.size + items2.size + items3.size);
await storage.close();
});
......@@ -605,9 +605,9 @@ flakySuite('SQLite Storage Library', function () {
await storage.updateItems({ insert: items });
let storedItems = await storage.getItems();
equal(items.get('colorthemedata'), storedItems.get('colorthemedata'));
equal(items.get('commandpalette.mru.cache'), storedItems.get('commandpalette.mru.cache'));
equal(items.get('super.large.string'), storedItems.get('super.large.string'));
strictEqual(items.get('colorthemedata'), storedItems.get('colorthemedata'));
strictEqual(items.get('commandpalette.mru.cache'), storedItems.get('commandpalette.mru.cache'));
strictEqual(items.get('super.large.string'), storedItems.get('super.large.string'));
uuid = generateUuid();
value = [];
......@@ -619,17 +619,17 @@ flakySuite('SQLite Storage Library', function () {
await storage.updateItems({ insert: items });
storedItems = await storage.getItems();
equal(items.get('colorthemedata'), storedItems.get('colorthemedata'));
equal(items.get('commandpalette.mru.cache'), storedItems.get('commandpalette.mru.cache'));
equal(items.get('super.large.string'), storedItems.get('super.large.string'));
strictEqual(items.get('colorthemedata'), storedItems.get('colorthemedata'));
strictEqual(items.get('commandpalette.mru.cache'), storedItems.get('commandpalette.mru.cache'));
strictEqual(items.get('super.large.string'), storedItems.get('super.large.string'));
const toDelete = new Set<string>();
toDelete.add('super.large.string');
await storage.updateItems({ delete: toDelete });
storedItems = await storage.getItems();
equal(items.get('colorthemedata'), storedItems.get('colorthemedata'));
equal(items.get('commandpalette.mru.cache'), storedItems.get('commandpalette.mru.cache'));
strictEqual(items.get('colorthemedata'), storedItems.get('colorthemedata'));
strictEqual(items.get('commandpalette.mru.cache'), storedItems.get('commandpalette.mru.cache'));
ok(!storedItems.get('super.large.string'));
await storage.close();
......@@ -676,14 +676,14 @@ flakySuite('SQLite Storage Library', function () {
await storage.set('some/foo3/path', 'some/bar/path');
const items = await storage.getStorage().getItems();
equal(items.get('foo'), 'bar');
equal(items.get('some/foo/path'), 'some/bar/path');
equal(items.has('foo1'), false);
equal(items.has('some/foo1/path'), false);
equal(items.get('foo2'), 'bar');
equal(items.get('some/foo2/path'), 'some/bar/path');
equal(items.get('foo3'), 'bar');
equal(items.get('some/foo3/path'), 'some/bar/path');
strictEqual(items.get('foo'), 'bar');
strictEqual(items.get('some/foo/path'), 'some/bar/path');
strictEqual(items.has('foo1'), false);
strictEqual(items.has('some/foo1/path'), false);
strictEqual(items.get('foo2'), 'bar');
strictEqual(items.get('some/foo2/path'), 'some/bar/path');
strictEqual(items.get('foo3'), 'bar');
strictEqual(items.get('some/foo3/path'), 'some/bar/path');
await storage.close();
});
......@@ -704,12 +704,12 @@ flakySuite('SQLite Storage Library', function () {
await storage.updateItems({ insert: items });
let storedItems = await storage.getItems();
equal(storedItems.size, items.size);
strictEqual(storedItems.size, items.size);
await storage.updateItems({ delete: keys });
storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await storage.close();
});
......@@ -730,12 +730,12 @@ flakySuite('SQLite Storage Library', function () {
await storage.updateItems({ insert: items });
let storedItems = await storage.getItems();
equal(storedItems.size, items.size);
strictEqual(storedItems.size, items.size);
await storage.updateItems({ delete: keys });
storedItems = await storage.getItems();
equal(storedItems.size, 0);
strictEqual(storedItems.size, 0);
await storage.close();
});
......
......@@ -33,28 +33,28 @@ suite('Actionbar', () => {
let a2 = new Action('a2');
actionbar.push(a1);
assert.equal(actionbar.hasAction(a1), true);
assert.equal(actionbar.hasAction(a2), false);
assert.strictEqual(actionbar.hasAction(a1), true);
assert.strictEqual(actionbar.hasAction(a2), false);
actionbar.pull(0);
assert.equal(actionbar.hasAction(a1), false);
assert.strictEqual(actionbar.hasAction(a1), false);
actionbar.push(a1, { index: 1 });
actionbar.push(a2, { index: 0 });
assert.equal(actionbar.hasAction(a1), true);
assert.equal(actionbar.hasAction(a2), true);
assert.strictEqual(actionbar.hasAction(a1), true);
assert.strictEqual(actionbar.hasAction(a2), true);
actionbar.pull(0);
assert.equal(actionbar.hasAction(a1), true);
assert.equal(actionbar.hasAction(a2), false);
assert.strictEqual(actionbar.hasAction(a1), true);
assert.strictEqual(actionbar.hasAction(a2), false);
actionbar.pull(0);
assert.equal(actionbar.hasAction(a1), false);
assert.equal(actionbar.hasAction(a2), false);
assert.strictEqual(actionbar.hasAction(a1), false);
assert.strictEqual(actionbar.hasAction(a2), false);
actionbar.push(a1);
assert.equal(actionbar.hasAction(a1), true);
assert.strictEqual(actionbar.hasAction(a1), true);
actionbar.clear();
assert.equal(actionbar.hasAction(a1), false);
assert.strictEqual(actionbar.hasAction(a1), false);
});
});
......@@ -123,8 +123,8 @@ suite('Comparers', () => {
// name-only comparisions
assert(compareFileExtensions('a', 'A') !== compareLocale('a', 'A'), 'the same letter of different case does not sort by locale');
assert(compareFileExtensions('â', 'Â') !== compareLocale('â', 'Â'), 'the same accented letter of different case does not sort by locale');
assert.notDeepEqual(['artichoke', 'Artichoke', 'art', 'Art'].sort(compareFileExtensions), ['artichoke', 'Artichoke', 'art', 'Art'].sort(compareLocale), 'words with the same root and different cases do not sort in locale order');
assert.notDeepEqual(['email', 'Email', 'émail', 'Émail'].sort(compareFileExtensions), ['email', 'Email', 'émail', 'Émail'].sort((a, b) => a.localeCompare(b)), 'the same base characters with different case or accents do not sort in locale order');
assert.notDeepStrictEqual(['artichoke', 'Artichoke', 'art', 'Art'].sort(compareFileExtensions), ['artichoke', 'Artichoke', 'art', 'Art'].sort(compareLocale), 'words with the same root and different cases do not sort in locale order');
assert.notDeepStrictEqual(['email', 'Email', 'émail', 'Émail'].sort(compareFileExtensions), ['email', 'Email', 'émail', 'Émail'].sort((a, b) => a.localeCompare(b)), 'the same base characters with different case or accents do not sort in locale order');
// name plus extension comparisons
assert(compareFileExtensions('a.MD', 'a.md') !== compareLocale('MD', 'md'), 'case differences in extensions do not sort by locale');
......@@ -197,7 +197,7 @@ suite('Comparers', () => {
// name-only comparisons
assert(compareFileNamesDefault('a', 'A') === compareLocale('a', 'A'), 'the same letter sorts by locale');
assert(compareFileNamesDefault('â', 'Â') === compareLocale('â', 'Â'), 'the same accented letter sorts by locale');
assert.deepEqual(['email', 'Email', 'émail', 'Émail'].sort(compareFileNamesDefault), ['email', 'Email', 'émail', 'Émail'].sort(compareLocale), 'the same base characters with different case or accents sort in locale order');
assert.deepStrictEqual(['email', 'Email', 'émail', 'Émail'].sort(compareFileNamesDefault), ['email', 'Email', 'émail', 'Émail'].sort(compareLocale), 'the same base characters with different case or accents sort in locale order');
// numeric comparisons
assert(compareFileNamesDefault('abc02.txt', 'abc002.txt') < 0, 'filenames with equivalent numbers and leading zeros sort shortest number first');
......@@ -258,7 +258,7 @@ suite('Comparers', () => {
// name-only comparisons
assert(compareFileExtensionsDefault('a', 'A') === compareLocale('a', 'A'), 'the same letter of different case sorts by locale');
assert(compareFileExtensionsDefault('â', 'Â') === compareLocale('â', 'Â'), 'the same accented letter of different case sorts by locale');
assert.deepEqual(['email', 'Email', 'émail', 'Émail'].sort(compareFileExtensionsDefault), ['email', 'Email', 'émail', 'Émail'].sort((a, b) => a.localeCompare(b)), 'the same base characters with different case or accents sort in locale order');
assert.deepStrictEqual(['email', 'Email', 'émail', 'Émail'].sort(compareFileExtensionsDefault), ['email', 'Email', 'émail', 'Émail'].sort((a, b) => a.localeCompare(b)), 'the same base characters with different case or accents sort in locale order');
// name plus extension comparisons
assert(compareFileExtensionsDefault('a.MD', 'a.md') === compareLocale('MD', 'md'), 'case differences in extensions sort by locale');
......
......@@ -11,25 +11,25 @@ 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'), '');
});
(!platform.isWindows ? test.skip : test)('isUNC', () => {
......@@ -73,37 +73,37 @@ 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.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.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('.', '/the/cwd'), '/the/cwd');
assert.strictEqual(extpath.sanitizeFilePath('', '/the/cwd'), '/the/cwd');
assert.strictEqual(extpath.sanitizeFilePath('/', '/the/cwd'), '/');
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.strictEqual(extpath.sanitizeFilePath('my.txt', '/the/cwd'), '/the/cwd/my.txt');
assert.strictEqual(extpath.sanitizeFilePath('my.txt/', '/the/cwd'), '/the/cwd/my.txt');
}
});
......@@ -137,12 +137,12 @@ suite('Paths', () => {
test('getDriveLetter', () => {
if (platform.isWindows) {
assert.equal(extpath.getDriveLetter('c:'), 'c');
assert.equal(extpath.getDriveLetter('D:'), 'D');
assert.equal(extpath.getDriveLetter('D:/'), 'D');
assert.equal(extpath.getDriveLetter('D:\\'), 'D');
assert.equal(extpath.getDriveLetter('D:\\path'), 'D');
assert.equal(extpath.getDriveLetter('D:/path'), 'D');
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'));
......@@ -157,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);
});
});
......@@ -11,95 +11,95 @@ suite('Labels', () => {
(!platform.isWindows ? test.skip : test)('shorten - windows', () => {
// nothing to shorten
assert.deepEqual(labels.shorten(['a']), ['a']);
assert.deepEqual(labels.shorten(['a', 'b']), ['a', 'b']);
assert.deepEqual(labels.shorten(['a', 'b', 'c']), ['a', 'b', 'c']);
assert.deepStrictEqual(labels.shorten(['a']), ['a']);
assert.deepStrictEqual(labels.shorten(['a', 'b']), ['a', 'b']);
assert.deepStrictEqual(labels.shorten(['a', 'b', 'c']), ['a', 'b', 'c']);
// completely different paths
assert.deepEqual(labels.shorten(['a\\b', 'c\\d', 'e\\f']), ['\\b', '\\d', '\\f']);
assert.deepStrictEqual(labels.shorten(['a\\b', 'c\\d', 'e\\f']), ['\\b', '\\d', '\\f']);
// same beginning
assert.deepEqual(labels.shorten(['a', 'a\\b']), ['a', '\\b']);
assert.deepEqual(labels.shorten(['a\\b', 'a\\b\\c']), ['\\b', '\\c']);
assert.deepEqual(labels.shorten(['a', 'a\\b', 'a\\b\\c']), ['a', '\\b', '\\c']);
assert.deepEqual(labels.shorten(['x:\\a\\b', 'x:\\a\\c']), ['x:\\\\b', 'x:\\\\c']);
assert.deepEqual(labels.shorten(['\\\\a\\b', '\\\\a\\c']), ['\\\\a\\b', '\\\\a\\c']);
assert.deepStrictEqual(labels.shorten(['a', 'a\\b']), ['a', '\\b']);
assert.deepStrictEqual(labels.shorten(['a\\b', 'a\\b\\c']), ['\\b', '\\c']);
assert.deepStrictEqual(labels.shorten(['a', 'a\\b', 'a\\b\\c']), ['a', '\\b', '\\c']);
assert.deepStrictEqual(labels.shorten(['x:\\a\\b', 'x:\\a\\c']), ['x:\\\\b', 'x:\\\\c']);
assert.deepStrictEqual(labels.shorten(['\\\\a\\b', '\\\\a\\c']), ['\\\\a\\b', '\\\\a\\c']);
// same ending
assert.deepEqual(labels.shorten(['a', 'b\\a']), ['a', 'b\\']);
assert.deepEqual(labels.shorten(['a\\b\\c', 'd\\b\\c']), ['a\\', 'd\\']);
assert.deepEqual(labels.shorten(['a\\b\\c\\d', 'f\\b\\c\\d']), ['a\\', 'f\\']);
assert.deepEqual(labels.shorten(['d\\e\\a\\b\\c', 'd\\b\\c']), ['\\a\\', 'd\\b\\']);
assert.deepEqual(labels.shorten(['a\\b\\c\\d', 'a\\f\\b\\c\\d']), ['a\\b\\', '\\f\\']);
assert.deepEqual(labels.shorten(['a\\b\\a', 'b\\b\\a']), ['a\\b\\', 'b\\b\\']);
assert.deepEqual(labels.shorten(['d\\f\\a\\b\\c', 'h\\d\\b\\c']), ['\\a\\', 'h\\']);
assert.deepEqual(labels.shorten(['a\\b\\c', 'x:\\0\\a\\b\\c']), ['a\\b\\c', 'x:\\0\\']);
assert.deepEqual(labels.shorten(['x:\\a\\b\\c', 'x:\\0\\a\\b\\c']), ['x:\\a\\', 'x:\\0\\']);
assert.deepEqual(labels.shorten(['x:\\a\\b', 'y:\\a\\b']), ['x:\\', 'y:\\']);
assert.deepEqual(labels.shorten(['x:\\a', 'x:\\c']), ['x:\\a', 'x:\\c']);
assert.deepEqual(labels.shorten(['x:\\a\\b', 'y:\\x\\a\\b']), ['x:\\', 'y:\\']);
assert.deepEqual(labels.shorten(['\\\\x\\b', '\\\\y\\b']), ['\\\\x\\', '\\\\y\\']);
assert.deepEqual(labels.shorten(['\\\\x\\a', '\\\\x\\b']), ['\\\\x\\a', '\\\\x\\b']);
assert.deepStrictEqual(labels.shorten(['a', 'b\\a']), ['a', 'b\\']);
assert.deepStrictEqual(labels.shorten(['a\\b\\c', 'd\\b\\c']), ['a\\', 'd\\']);
assert.deepStrictEqual(labels.shorten(['a\\b\\c\\d', 'f\\b\\c\\d']), ['a\\', 'f\\']);
assert.deepStrictEqual(labels.shorten(['d\\e\\a\\b\\c', 'd\\b\\c']), ['\\a\\', 'd\\b\\']);
assert.deepStrictEqual(labels.shorten(['a\\b\\c\\d', 'a\\f\\b\\c\\d']), ['a\\b\\', '\\f\\']);
assert.deepStrictEqual(labels.shorten(['a\\b\\a', 'b\\b\\a']), ['a\\b\\', 'b\\b\\']);
assert.deepStrictEqual(labels.shorten(['d\\f\\a\\b\\c', 'h\\d\\b\\c']), ['\\a\\', 'h\\']);
assert.deepStrictEqual(labels.shorten(['a\\b\\c', 'x:\\0\\a\\b\\c']), ['a\\b\\c', 'x:\\0\\']);
assert.deepStrictEqual(labels.shorten(['x:\\a\\b\\c', 'x:\\0\\a\\b\\c']), ['x:\\a\\', 'x:\\0\\']);
assert.deepStrictEqual(labels.shorten(['x:\\a\\b', 'y:\\a\\b']), ['x:\\', 'y:\\']);
assert.deepStrictEqual(labels.shorten(['x:\\a', 'x:\\c']), ['x:\\a', 'x:\\c']);
assert.deepStrictEqual(labels.shorten(['x:\\a\\b', 'y:\\x\\a\\b']), ['x:\\', 'y:\\']);
assert.deepStrictEqual(labels.shorten(['\\\\x\\b', '\\\\y\\b']), ['\\\\x\\', '\\\\y\\']);
assert.deepStrictEqual(labels.shorten(['\\\\x\\a', '\\\\x\\b']), ['\\\\x\\a', '\\\\x\\b']);
// same name ending
assert.deepEqual(labels.shorten(['a\\b', 'a\\c', 'a\\e-b']), ['\\b', '\\c', '\\e-b']);
assert.deepStrictEqual(labels.shorten(['a\\b', 'a\\c', 'a\\e-b']), ['\\b', '\\c', '\\e-b']);
// same in the middle
assert.deepEqual(labels.shorten(['a\\b\\c', 'd\\b\\e']), ['\\c', '\\e']);
assert.deepStrictEqual(labels.shorten(['a\\b\\c', 'd\\b\\e']), ['\\c', '\\e']);
// case-sensetive
assert.deepEqual(labels.shorten(['a\\b\\c', 'd\\b\\C']), ['\\c', '\\C']);
assert.deepStrictEqual(labels.shorten(['a\\b\\c', 'd\\b\\C']), ['\\c', '\\C']);
// empty or null
assert.deepEqual(labels.shorten(['', null!]), ['.\\', null]);
assert.deepStrictEqual(labels.shorten(['', null!]), ['.\\', null]);
assert.deepEqual(labels.shorten(['a', 'a\\b', 'a\\b\\c', 'd\\b\\c', 'd\\b']), ['a', 'a\\b', 'a\\b\\c', 'd\\b\\c', 'd\\b']);
assert.deepEqual(labels.shorten(['a', 'a\\b', 'b']), ['a', 'a\\b', 'b']);
assert.deepEqual(labels.shorten(['', 'a', 'b', 'b\\c', 'a\\c']), ['.\\', 'a', 'b', 'b\\c', 'a\\c']);
assert.deepEqual(labels.shorten(['src\\vs\\workbench\\parts\\execution\\electron-browser', 'src\\vs\\workbench\\parts\\execution\\electron-browser\\something', 'src\\vs\\workbench\\parts\\terminal\\electron-browser']), ['\\execution\\electron-browser', '\\something', '\\terminal\\']);
assert.deepStrictEqual(labels.shorten(['a', 'a\\b', 'a\\b\\c', 'd\\b\\c', 'd\\b']), ['a', 'a\\b', 'a\\b\\c', 'd\\b\\c', 'd\\b']);
assert.deepStrictEqual(labels.shorten(['a', 'a\\b', 'b']), ['a', 'a\\b', 'b']);
assert.deepStrictEqual(labels.shorten(['', 'a', 'b', 'b\\c', 'a\\c']), ['.\\', 'a', 'b', 'b\\c', 'a\\c']);
assert.deepStrictEqual(labels.shorten(['src\\vs\\workbench\\parts\\execution\\electron-browser', 'src\\vs\\workbench\\parts\\execution\\electron-browser\\something', 'src\\vs\\workbench\\parts\\terminal\\electron-browser']), ['\\execution\\electron-browser', '\\something', '\\terminal\\']);
});
(platform.isWindows ? test.skip : test)('shorten - not windows', () => {
// nothing to shorten
assert.deepEqual(labels.shorten(['a']), ['a']);
assert.deepEqual(labels.shorten(['a', 'b']), ['a', 'b']);
assert.deepEqual(labels.shorten(['a', 'b', 'c']), ['a', 'b', 'c']);
assert.deepStrictEqual(labels.shorten(['a']), ['a']);
assert.deepStrictEqual(labels.shorten(['a', 'b']), ['a', 'b']);
assert.deepStrictEqual(labels.shorten(['a', 'b', 'c']), ['a', 'b', 'c']);
// completely different paths
assert.deepEqual(labels.shorten(['a/b', 'c/d', 'e/f']), ['…/b', '…/d', '…/f']);
assert.deepStrictEqual(labels.shorten(['a/b', 'c/d', 'e/f']), ['…/b', '…/d', '…/f']);
// same beginning
assert.deepEqual(labels.shorten(['a', 'a/b']), ['a', '…/b']);
assert.deepEqual(labels.shorten(['a/b', 'a/b/c']), ['…/b', '…/c']);
assert.deepEqual(labels.shorten(['a', 'a/b', 'a/b/c']), ['a', '…/b', '…/c']);
assert.deepEqual(labels.shorten(['/a/b', '/a/c']), ['/a/b', '/a/c']);
assert.deepStrictEqual(labels.shorten(['a', 'a/b']), ['a', '…/b']);
assert.deepStrictEqual(labels.shorten(['a/b', 'a/b/c']), ['…/b', '…/c']);
assert.deepStrictEqual(labels.shorten(['a', 'a/b', 'a/b/c']), ['a', '…/b', '…/c']);
assert.deepStrictEqual(labels.shorten(['/a/b', '/a/c']), ['/a/b', '/a/c']);
// same ending
assert.deepEqual(labels.shorten(['a', 'b/a']), ['a', 'b/…']);
assert.deepEqual(labels.shorten(['a/b/c', 'd/b/c']), ['a/…', 'd/…']);
assert.deepEqual(labels.shorten(['a/b/c/d', 'f/b/c/d']), ['a/…', 'f/…']);
assert.deepEqual(labels.shorten(['d/e/a/b/c', 'd/b/c']), ['…/a/…', 'd/b/…']);
assert.deepEqual(labels.shorten(['a/b/c/d', 'a/f/b/c/d']), ['a/b/…', '…/f/…']);
assert.deepEqual(labels.shorten(['a/b/a', 'b/b/a']), ['a/b/…', 'b/b/…']);
assert.deepEqual(labels.shorten(['d/f/a/b/c', 'h/d/b/c']), ['…/a/…', 'h/…']);
assert.deepEqual(labels.shorten(['/x/b', '/y/b']), ['/x/…', '/y/…']);
assert.deepStrictEqual(labels.shorten(['a', 'b/a']), ['a', 'b/…']);
assert.deepStrictEqual(labels.shorten(['a/b/c', 'd/b/c']), ['a/…', 'd/…']);
assert.deepStrictEqual(labels.shorten(['a/b/c/d', 'f/b/c/d']), ['a/…', 'f/…']);
assert.deepStrictEqual(labels.shorten(['d/e/a/b/c', 'd/b/c']), ['…/a/…', 'd/b/…']);
assert.deepStrictEqual(labels.shorten(['a/b/c/d', 'a/f/b/c/d']), ['a/b/…', '…/f/…']);
assert.deepStrictEqual(labels.shorten(['a/b/a', 'b/b/a']), ['a/b/…', 'b/b/…']);
assert.deepStrictEqual(labels.shorten(['d/f/a/b/c', 'h/d/b/c']), ['…/a/…', 'h/…']);
assert.deepStrictEqual(labels.shorten(['/x/b', '/y/b']), ['/x/…', '/y/…']);
// same name ending
assert.deepEqual(labels.shorten(['a/b', 'a/c', 'a/e-b']), ['…/b', '…/c', '…/e-b']);
assert.deepStrictEqual(labels.shorten(['a/b', 'a/c', 'a/e-b']), ['…/b', '…/c', '…/e-b']);
// same in the middle
assert.deepEqual(labels.shorten(['a/b/c', 'd/b/e']), ['…/c', '…/e']);
assert.deepStrictEqual(labels.shorten(['a/b/c', 'd/b/e']), ['…/c', '…/e']);
// case-sensitive
assert.deepEqual(labels.shorten(['a/b/c', 'd/b/C']), ['…/c', '…/C']);
assert.deepStrictEqual(labels.shorten(['a/b/c', 'd/b/C']), ['…/c', '…/C']);
// empty or null
assert.deepEqual(labels.shorten(['', null!]), ['./', null]);
assert.deepStrictEqual(labels.shorten(['', null!]), ['./', null]);
assert.deepEqual(labels.shorten(['a', 'a/b', 'a/b/c', 'd/b/c', 'd/b']), ['a', 'a/b', 'a/b/c', 'd/b/c', 'd/b']);
assert.deepEqual(labels.shorten(['a', 'a/b', 'b']), ['a', 'a/b', 'b']);
assert.deepEqual(labels.shorten(['', 'a', 'b', 'b/c', 'a/c']), ['./', 'a', 'b', 'b/c', 'a/c']);
assert.deepStrictEqual(labels.shorten(['a', 'a/b', 'a/b/c', 'd/b/c', 'd/b']), ['a', 'a/b', 'a/b/c', 'd/b/c', 'd/b']);
assert.deepStrictEqual(labels.shorten(['a', 'a/b', 'b']), ['a', 'a/b', 'b']);
assert.deepStrictEqual(labels.shorten(['', 'a', 'b', 'b/c', 'a/c']), ['./', 'a', 'b', 'b/c', 'a/c']);
});
test('template', () => {
......@@ -135,31 +135,31 @@ suite('Labels', () => {
});
(platform.isWindows ? test.skip : test)('getBaseLabel - unix', () => {
assert.equal(labels.getBaseLabel('/some/folder/file.txt'), 'file.txt');
assert.equal(labels.getBaseLabel('/some/folder'), 'folder');
assert.equal(labels.getBaseLabel('/'), '/');
assert.strictEqual(labels.getBaseLabel('/some/folder/file.txt'), 'file.txt');
assert.strictEqual(labels.getBaseLabel('/some/folder'), 'folder');
assert.strictEqual(labels.getBaseLabel('/'), '/');
});
(!platform.isWindows ? test.skip : test)('getBaseLabel - windows', () => {
assert.equal(labels.getBaseLabel('c:'), 'C:');
assert.equal(labels.getBaseLabel('c:\\'), 'C:');
assert.equal(labels.getBaseLabel('c:\\some\\folder\\file.txt'), 'file.txt');
assert.equal(labels.getBaseLabel('c:\\some\\folder'), 'folder');
assert.equal(labels.getBaseLabel('c:\\some\\f:older'), 'f:older'); // https://github.com/microsoft/vscode-remote-release/issues/4227
assert.strictEqual(labels.getBaseLabel('c:'), 'C:');
assert.strictEqual(labels.getBaseLabel('c:\\'), 'C:');
assert.strictEqual(labels.getBaseLabel('c:\\some\\folder\\file.txt'), 'file.txt');
assert.strictEqual(labels.getBaseLabel('c:\\some\\folder'), 'folder');
assert.strictEqual(labels.getBaseLabel('c:\\some\\f:older'), 'f:older'); // https://github.com/microsoft/vscode-remote-release/issues/4227
});
test('mnemonicButtonLabel', () => {
assert.equal(labels.mnemonicButtonLabel('Hello World'), 'Hello World');
assert.equal(labels.mnemonicButtonLabel(''), '');
assert.strictEqual(labels.mnemonicButtonLabel('Hello World'), 'Hello World');
assert.strictEqual(labels.mnemonicButtonLabel(''), '');
if (platform.isWindows) {
assert.equal(labels.mnemonicButtonLabel('Hello & World'), 'Hello && World');
assert.equal(labels.mnemonicButtonLabel('Do &&not Save & Continue'), 'Do &not Save && Continue');
assert.strictEqual(labels.mnemonicButtonLabel('Hello & World'), 'Hello && World');
assert.strictEqual(labels.mnemonicButtonLabel('Do &&not Save & Continue'), 'Do &not Save && Continue');
} else if (platform.isMacintosh) {
assert.equal(labels.mnemonicButtonLabel('Hello & World'), 'Hello & World');
assert.equal(labels.mnemonicButtonLabel('Do &&not Save & Continue'), 'Do not Save & Continue');
assert.strictEqual(labels.mnemonicButtonLabel('Hello & World'), 'Hello & World');
assert.strictEqual(labels.mnemonicButtonLabel('Do &&not Save & Continue'), 'Do not Save & Continue');
} else {
assert.equal(labels.mnemonicButtonLabel('Hello & World'), 'Hello & World');
assert.equal(labels.mnemonicButtonLabel('Do &&not Save & Continue'), 'Do _not Save & Continue');
assert.strictEqual(labels.mnemonicButtonLabel('Hello & World'), 'Hello & World');
assert.strictEqual(labels.mnemonicButtonLabel('Do &&not Save & Continue'), 'Do _not Save & Continue');
}
});
});
......@@ -11,38 +11,38 @@ suite('Mime', () => {
test('Dynamically Register Text Mime', () => {
let guess = guessMimeTypes(URI.file('foo.monaco'));
assert.deepEqual(guess, ['application/unknown']);
assert.deepStrictEqual(guess, ['application/unknown']);
registerTextMime({ id: 'monaco', extension: '.monaco', mime: 'text/monaco' });
guess = guessMimeTypes(URI.file('foo.monaco'));
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
guess = guessMimeTypes(URI.file('.monaco'));
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
registerTextMime({ id: 'codefile', filename: 'Codefile', mime: 'text/code' });
guess = guessMimeTypes(URI.file('Codefile'));
assert.deepEqual(guess, ['text/code', 'text/plain']);
assert.deepStrictEqual(guess, ['text/code', 'text/plain']);
guess = guessMimeTypes(URI.file('foo.Codefile'));
assert.deepEqual(guess, ['application/unknown']);
assert.deepStrictEqual(guess, ['application/unknown']);
registerTextMime({ id: 'docker', filepattern: 'Docker*', mime: 'text/docker' });
guess = guessMimeTypes(URI.file('Docker-debug'));
assert.deepEqual(guess, ['text/docker', 'text/plain']);
assert.deepStrictEqual(guess, ['text/docker', 'text/plain']);
guess = guessMimeTypes(URI.file('docker-PROD'));
assert.deepEqual(guess, ['text/docker', 'text/plain']);
assert.deepStrictEqual(guess, ['text/docker', 'text/plain']);
registerTextMime({ id: 'niceregex', mime: 'text/nice-regex', firstline: /RegexesAreNice/ });
guess = guessMimeTypes(URI.file('Randomfile.noregistration'), 'RegexesAreNice');
assert.deepEqual(guess, ['text/nice-regex', 'text/plain']);
assert.deepStrictEqual(guess, ['text/nice-regex', 'text/plain']);
guess = guessMimeTypes(URI.file('Randomfile.noregistration'), 'RegexesAreNotNice');
assert.deepEqual(guess, ['application/unknown']);
assert.deepStrictEqual(guess, ['application/unknown']);
guess = guessMimeTypes(URI.file('Codefile'), 'RegexesAreNice');
assert.deepEqual(guess, ['text/code', 'text/plain']);
assert.deepStrictEqual(guess, ['text/code', 'text/plain']);
});
test('Mimes Priority', () => {
......@@ -50,36 +50,36 @@ suite('Mime', () => {
registerTextMime({ id: 'foobar', mime: 'text/foobar', firstline: /foobar/ });
let guess = guessMimeTypes(URI.file('foo.monaco'));
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
guess = guessMimeTypes(URI.file('foo.monaco'), 'foobar');
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
registerTextMime({ id: 'docker', filename: 'dockerfile', mime: 'text/winner' });
registerTextMime({ id: 'docker', filepattern: 'dockerfile*', mime: 'text/looser' });
guess = guessMimeTypes(URI.file('dockerfile'));
assert.deepEqual(guess, ['text/winner', 'text/plain']);
assert.deepStrictEqual(guess, ['text/winner', 'text/plain']);
registerTextMime({ id: 'azure-looser', mime: 'text/azure-looser', firstline: /azure/ });
registerTextMime({ id: 'azure-winner', mime: 'text/azure-winner', firstline: /azure/ });
guess = guessMimeTypes(URI.file('azure'), 'azure');
assert.deepEqual(guess, ['text/azure-winner', 'text/plain']);
assert.deepStrictEqual(guess, ['text/azure-winner', 'text/plain']);
});
test('Specificity priority 1', () => {
registerTextMime({ id: 'monaco2', extension: '.monaco2', mime: 'text/monaco2' });
registerTextMime({ id: 'monaco2', filename: 'specific.monaco2', mime: 'text/specific-monaco2' });
assert.deepEqual(guessMimeTypes(URI.file('specific.monaco2')), ['text/specific-monaco2', 'text/plain']);
assert.deepEqual(guessMimeTypes(URI.file('foo.monaco2')), ['text/monaco2', 'text/plain']);
assert.deepStrictEqual(guessMimeTypes(URI.file('specific.monaco2')), ['text/specific-monaco2', 'text/plain']);
assert.deepStrictEqual(guessMimeTypes(URI.file('foo.monaco2')), ['text/monaco2', 'text/plain']);
});
test('Specificity priority 2', () => {
registerTextMime({ id: 'monaco3', filename: 'specific.monaco3', mime: 'text/specific-monaco3' });
registerTextMime({ id: 'monaco3', extension: '.monaco3', mime: 'text/monaco3' });
assert.deepEqual(guessMimeTypes(URI.file('specific.monaco3')), ['text/specific-monaco3', 'text/plain']);
assert.deepEqual(guessMimeTypes(URI.file('foo.monaco3')), ['text/monaco3', 'text/plain']);
assert.deepStrictEqual(guessMimeTypes(URI.file('specific.monaco3')), ['text/specific-monaco3', 'text/plain']);
assert.deepStrictEqual(guessMimeTypes(URI.file('foo.monaco3')), ['text/monaco3', 'text/plain']);
});
test('Mimes Priority - Longest Extension wins', () => {
......@@ -88,13 +88,13 @@ suite('Mime', () => {
registerTextMime({ id: 'monaco', extension: '.monaco.xml.build', mime: 'text/monaco-xml-build' });
let guess = guessMimeTypes(URI.file('foo.monaco'));
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
guess = guessMimeTypes(URI.file('foo.monaco.xml'));
assert.deepEqual(guess, ['text/monaco-xml', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco-xml', 'text/plain']);
guess = guessMimeTypes(URI.file('foo.monaco.xml.build'));
assert.deepEqual(guess, ['text/monaco-xml-build', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco-xml-build', 'text/plain']);
});
test('Mimes Priority - User configured wins', () => {
......@@ -102,7 +102,7 @@ suite('Mime', () => {
registerTextMime({ id: 'monaco', extension: '.monaco.xml', mime: 'text/monaco-xml' });
let guess = guessMimeTypes(URI.file('foo.monaco.xnl'));
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
});
test('Mimes Priority - Pattern matches on path if specified', () => {
......@@ -110,7 +110,7 @@ suite('Mime', () => {
registerTextMime({ id: 'other', filepattern: '*ot.other.xml', mime: 'text/other' });
let guess = guessMimeTypes(URI.file('/some/path/dot.monaco.xml'));
assert.deepEqual(guess, ['text/monaco', 'text/plain']);
assert.deepStrictEqual(guess, ['text/monaco', 'text/plain']);
});
test('Mimes Priority - Last registered mime wins', () => {
......@@ -118,12 +118,12 @@ suite('Mime', () => {
registerTextMime({ id: 'other', filepattern: '**/dot.monaco.xml', mime: 'text/other' });
let guess = guessMimeTypes(URI.file('/some/path/dot.monaco.xml'));
assert.deepEqual(guess, ['text/other', 'text/plain']);
assert.deepStrictEqual(guess, ['text/other', 'text/plain']);
});
test('Data URIs', () => {
registerTextMime({ id: 'data', extension: '.data', mime: 'text/data' });
assert.deepEqual(guessMimeTypes(URI.parse(`data:;label:something.data;description:data,`)), ['text/data', 'text/plain']);
assert.deepStrictEqual(guessMimeTypes(URI.parse(`data:;label:something.data;description:data,`)), ['text/data', 'text/plain']);
});
});
......@@ -43,37 +43,37 @@ suite('Stream', () => {
chunks.push(data);
});
assert.equal(chunks[0], 'Hello');
assert.strictEqual(chunks[0], 'Hello');
stream.write('World');
assert.equal(chunks[1], 'World');
assert.strictEqual(chunks[1], 'World');
assert.equal(error, false);
assert.equal(end, false);
assert.strictEqual(error, false);
assert.strictEqual(end, false);
stream.pause();
stream.write('1');
stream.write('2');
stream.write('3');
assert.equal(chunks.length, 2);
assert.strictEqual(chunks.length, 2);
stream.resume();
assert.equal(chunks.length, 3);
assert.equal(chunks[2], '1,2,3');
assert.strictEqual(chunks.length, 3);
assert.strictEqual(chunks[2], '1,2,3');
stream.error(new Error());
assert.equal(error, true);
assert.strictEqual(error, true);
stream.end('Final Bit');
assert.equal(chunks.length, 4);
assert.equal(chunks[3], 'Final Bit');
assert.strictEqual(chunks.length, 4);
assert.strictEqual(chunks[3], 'Final Bit');
stream.destroy();
stream.write('Unexpected');
assert.equal(chunks.length, 4);
assert.strictEqual(chunks.length, 4);
});
test('WriteableStream - removeListener', () => {
......@@ -92,16 +92,16 @@ suite('Stream', () => {
stream.on('data', dataListener);
stream.write('Hello');
assert.equal(data, true);
assert.strictEqual(data, true);
data = false;
stream.removeListener('data', dataListener);
stream.write('World');
assert.equal(data, false);
assert.strictEqual(data, false);
stream.error(new Error());
assert.equal(error, true);
assert.strictEqual(error, true);
error = false;
stream.removeListener('error', errorListener);
......@@ -109,7 +109,7 @@ suite('Stream', () => {
// always leave at least one error listener to streams to avoid unexpected errors during test running
stream.on('error', () => { });
stream.error(new Error());
assert.equal(error, false);
assert.strictEqual(error, false);
});
test('WriteableStream - highWaterMark', async () => {
......@@ -149,14 +149,14 @@ suite('Stream', () => {
assert.ok(data);
await timeout(0);
assert.equal(drained1, true);
assert.equal(drained2, true);
assert.strictEqual(drained1, true);
assert.strictEqual(drained2, true);
});
test('consumeReadable', () => {
const readable = arrayToReadable(['1', '2', '3', '4', '5']);
const consumed = consumeReadable(readable, strings => strings.join());
assert.equal(consumed, '1,2,3,4,5');
assert.strictEqual(consumed, '1,2,3,4,5');
});
test('peekReadable', () => {
......@@ -168,17 +168,17 @@ suite('Stream', () => {
assert.fail('Unexpected result');
} else {
const consumed = consumeReadable(consumedOrReadable, strings => strings.join());
assert.equal(consumed, '1,2,3,4,5');
assert.strictEqual(consumed, '1,2,3,4,5');
}
}
let readable = arrayToReadable(['1', '2', '3', '4', '5']);
let consumedOrReadable = peekReadable(readable, strings => strings.join(), 5);
assert.equal(consumedOrReadable, '1,2,3,4,5');
assert.strictEqual(consumedOrReadable, '1,2,3,4,5');
readable = arrayToReadable(['1', '2', '3', '4', '5']);
consumedOrReadable = peekReadable(readable, strings => strings.join(), 6);
assert.equal(consumedOrReadable, '1,2,3,4,5');
assert.strictEqual(consumedOrReadable, '1,2,3,4,5');
});
test('peekReadable - error handling', async () => {
......@@ -267,7 +267,7 @@ suite('Stream', () => {
test('consumeStream', async () => {
const stream = readableToStream(arrayToReadable(['1', '2', '3', '4', '5']));
const consumed = await consumeStream(stream, strings => strings.join());
assert.equal(consumed, '1,2,3,4,5');
assert.strictEqual(consumed, '1,2,3,4,5');
});
test('peekStream', async () => {
......@@ -275,11 +275,11 @@ suite('Stream', () => {
const stream = readableToStream(arrayToReadable(['1', '2', '3', '4', '5']));
const result = await peekStream(stream, i);
assert.equal(stream, result.stream);
assert.strictEqual(stream, result.stream);
if (result.ended) {
assert.fail('Unexpected result, stream should not have ended yet');
} else {
assert.equal(result.buffer.length, i + 1, `maxChunks: ${i}`);
assert.strictEqual(result.buffer.length, i + 1, `maxChunks: ${i}`);
const additionalResult: string[] = [];
await consumeStream(stream, strings => {
......@@ -288,33 +288,33 @@ suite('Stream', () => {
return strings.join();
});
assert.equal([...result.buffer, ...additionalResult].join(), '1,2,3,4,5');
assert.strictEqual([...result.buffer, ...additionalResult].join(), '1,2,3,4,5');
}
}
let stream = readableToStream(arrayToReadable(['1', '2', '3', '4', '5']));
let result = await peekStream(stream, 5);
assert.equal(stream, result.stream);
assert.equal(result.buffer.join(), '1,2,3,4,5');
assert.equal(result.ended, true);
assert.strictEqual(stream, result.stream);
assert.strictEqual(result.buffer.join(), '1,2,3,4,5');
assert.strictEqual(result.ended, true);
stream = readableToStream(arrayToReadable(['1', '2', '3', '4', '5']));
result = await peekStream(stream, 6);
assert.equal(stream, result.stream);
assert.equal(result.buffer.join(), '1,2,3,4,5');
assert.equal(result.ended, true);
assert.strictEqual(stream, result.stream);
assert.strictEqual(result.buffer.join(), '1,2,3,4,5');
assert.strictEqual(result.ended, true);
});
test('toStream', async () => {
const stream = toStream('1,2,3,4,5', strings => strings.join());
const consumed = await consumeStream(stream, strings => strings.join());
assert.equal(consumed, '1,2,3,4,5');
assert.strictEqual(consumed, '1,2,3,4,5');
});
test('toReadable', async () => {
const readable = toReadable('1,2,3,4,5');
const consumed = await consumeReadable(readable, strings => strings.join());
assert.equal(consumed, '1,2,3,4,5');
assert.strictEqual(consumed, '1,2,3,4,5');
});
test('transform', async () => {
......@@ -332,7 +332,7 @@ suite('Stream', () => {
}, 0);
const consumed = await consumeStream(result, strings => strings.join());
assert.equal(consumed, '11,22,33,44,55');
assert.strictEqual(consumed, '11,22,33,44,55');
});
test('observer', async () => {
......
......@@ -178,15 +178,15 @@ suite('Types', () => {
assert.throws(() => types.assertAllDefined(true, undefined));
assert.throws(() => types.assertAllDefined(undefined, false));
assert.equal(types.assertIsDefined(true), true);
assert.equal(types.assertIsDefined(false), false);
assert.equal(types.assertIsDefined('Hello'), 'Hello');
assert.equal(types.assertIsDefined(''), '');
assert.strictEqual(types.assertIsDefined(true), true);
assert.strictEqual(types.assertIsDefined(false), false);
assert.strictEqual(types.assertIsDefined('Hello'), 'Hello');
assert.strictEqual(types.assertIsDefined(''), '');
const res = types.assertAllDefined(1, true, 'Hello');
assert.equal(res[0], 1);
assert.equal(res[1], true);
assert.equal(res[2], 'Hello');
assert.strictEqual(res[0], 1);
assert.strictEqual(res[1], true);
assert.strictEqual(res[2], 'Hello');
});
test('validateConstraints', () => {
......
......@@ -11,12 +11,12 @@ suite('Decoder', () => {
test('decoding', () => {
const lineDecoder = new LineDecoder();
let res = lineDecoder.write(Buffer.from('hello'));
assert.equal(res.length, 0);
assert.strictEqual(res.length, 0);
res = lineDecoder.write(Buffer.from('\nworld'));
assert.equal(res[0], 'hello');
assert.equal(res.length, 1);
assert.strictEqual(res[0], 'hello');
assert.strictEqual(res.length, 1);
assert.equal(lineDecoder.end(), 'world');
assert.strictEqual(lineDecoder.end(), 'world');
});
});
......@@ -30,16 +30,16 @@ flakySuite('Extpath', () => {
const real = realcaseSync(upper);
if (real) { // can be null in case of permission errors
assert.notEqual(real, upper);
assert.equal(real.toUpperCase(), upper);
assert.equal(real, testDir);
assert.notStrictEqual(real, upper);
assert.strictEqual(real.toUpperCase(), upper);
assert.strictEqual(real, testDir);
}
}
// linux, unix, etc. -> assume case sensitive file system
else {
const real = realcaseSync(testDir);
assert.equal(real, testDir);
assert.strictEqual(real, testDir);
}
});
......
......@@ -13,35 +13,35 @@ suite('EnvironmentService', () => {
test('parseExtensionHostPort when built', () => {
const parse = (a: string[]) => parseExtensionHostPort(parseArgs(a, OPTIONS), true);
assert.deepEqual(parse([]), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost']), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugBrkPluginHost']), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugBrkPluginHost=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost=1234', '--debugBrkPluginHost=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
assert.deepStrictEqual(parse([]), { port: null, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugPluginHost']), { port: null, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugPluginHost=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugBrkPluginHost']), { port: null, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugBrkPluginHost=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepStrictEqual(parse(['--debugPluginHost=1234', '--debugBrkPluginHost=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
assert.deepEqual(parse(['--inspect-extensions']), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--inspect-extensions=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepEqual(parse(['--inspect-brk-extensions']), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--inspect-brk-extensions=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepEqual(parse(['--inspect-extensions=1234', '--inspect-brk-extensions=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
assert.deepStrictEqual(parse(['--inspect-extensions']), { port: null, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-extensions=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-brk-extensions']), { port: null, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-brk-extensions=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-extensions=1234', '--inspect-brk-extensions=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
});
test('parseExtensionHostPort when unbuilt', () => {
const parse = (a: string[]) => parseExtensionHostPort(parseArgs(a, OPTIONS), false);
assert.deepEqual(parse([]), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost']), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugBrkPluginHost']), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugBrkPluginHost=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost=1234', '--debugBrkPluginHost=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
assert.deepStrictEqual(parse([]), { port: 5870, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugPluginHost']), { port: 5870, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugPluginHost=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugBrkPluginHost']), { port: 5870, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--debugBrkPluginHost=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepStrictEqual(parse(['--debugPluginHost=1234', '--debugBrkPluginHost=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
assert.deepEqual(parse(['--inspect-extensions']), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--inspect-extensions=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepEqual(parse(['--inspect-brk-extensions']), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--inspect-brk-extensions=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepEqual(parse(['--inspect-extensions=1234', '--inspect-brk-extensions=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
assert.deepStrictEqual(parse(['--inspect-extensions']), { port: 5870, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-extensions=1234']), { port: 1234, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-brk-extensions']), { port: 5870, break: false, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-brk-extensions=5678']), { port: 5678, break: true, debugId: undefined });
assert.deepStrictEqual(parse(['--inspect-extensions=1234', '--inspect-brk-extensions=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
});
test('userDataPath', () => {
......@@ -57,10 +57,10 @@ suite('EnvironmentService', () => {
test('careful with boolean file names', function () {
let actual = parseArgs(['-r', 'arg.txt'], OPTIONS);
assert(actual['reuse-window']);
assert.deepEqual(actual._, ['arg.txt']);
assert.deepStrictEqual(actual._, ['arg.txt']);
actual = parseArgs(['-r', 'true.txt'], OPTIONS);
assert(actual['reuse-window']);
assert.deepEqual(actual._, ['true.txt']);
assert.deepStrictEqual(actual._, ['true.txt']);
});
});
......@@ -30,28 +30,28 @@ suite('NSFW Watcher Service', async () => {
test('should not impacts roots that don\'t overlap', () => {
const service = new TestNsfwWatcherService();
if (platform.isWindows) {
assert.deepEqual(service.normalizeRoots(['C:\\a']), ['C:\\a']);
assert.deepEqual(service.normalizeRoots(['C:\\a', 'C:\\b']), ['C:\\a', 'C:\\b']);
assert.deepEqual(service.normalizeRoots(['C:\\a', 'C:\\b', 'C:\\c\\d\\e']), ['C:\\a', 'C:\\b', 'C:\\c\\d\\e']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\a']), ['C:\\a']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\a', 'C:\\b']), ['C:\\a', 'C:\\b']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\a', 'C:\\b', 'C:\\c\\d\\e']), ['C:\\a', 'C:\\b', 'C:\\c\\d\\e']);
} else {
assert.deepEqual(service.normalizeRoots(['/a']), ['/a']);
assert.deepEqual(service.normalizeRoots(['/a', '/b']), ['/a', '/b']);
assert.deepEqual(service.normalizeRoots(['/a', '/b', '/c/d/e']), ['/a', '/b', '/c/d/e']);
assert.deepStrictEqual(service.normalizeRoots(['/a']), ['/a']);
assert.deepStrictEqual(service.normalizeRoots(['/a', '/b']), ['/a', '/b']);
assert.deepStrictEqual(service.normalizeRoots(['/a', '/b', '/c/d/e']), ['/a', '/b', '/c/d/e']);
}
});
test('should remove sub-folders of other roots', () => {
const service = new TestNsfwWatcherService();
if (platform.isWindows) {
assert.deepEqual(service.normalizeRoots(['C:\\a', 'C:\\a\\b']), ['C:\\a']);
assert.deepEqual(service.normalizeRoots(['C:\\a', 'C:\\b', 'C:\\a\\b']), ['C:\\a', 'C:\\b']);
assert.deepEqual(service.normalizeRoots(['C:\\b\\a', 'C:\\a', 'C:\\b', 'C:\\a\\b']), ['C:\\a', 'C:\\b']);
assert.deepEqual(service.normalizeRoots(['C:\\a', 'C:\\a\\b', 'C:\\a\\c\\d']), ['C:\\a']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\a', 'C:\\a\\b']), ['C:\\a']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\a', 'C:\\b', 'C:\\a\\b']), ['C:\\a', 'C:\\b']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\b\\a', 'C:\\a', 'C:\\b', 'C:\\a\\b']), ['C:\\a', 'C:\\b']);
assert.deepStrictEqual(service.normalizeRoots(['C:\\a', 'C:\\a\\b', 'C:\\a\\c\\d']), ['C:\\a']);
} else {
assert.deepEqual(service.normalizeRoots(['/a', '/a/b']), ['/a']);
assert.deepEqual(service.normalizeRoots(['/a', '/b', '/a/b']), ['/a', '/b']);
assert.deepEqual(service.normalizeRoots(['/b/a', '/a', '/b', '/a/b']), ['/a', '/b']);
assert.deepEqual(service.normalizeRoots(['/a', '/a/b', '/a/c/d']), ['/a']);
assert.deepStrictEqual(service.normalizeRoots(['/a', '/a/b']), ['/a']);
assert.deepStrictEqual(service.normalizeRoots(['/a', '/b', '/a/b']), ['/a', '/b']);
assert.deepStrictEqual(service.normalizeRoots(['/b/a', '/a', '/b', '/a/b']), ['/a', '/b']);
assert.deepStrictEqual(service.normalizeRoots(['/a', '/a/b', '/a/c/d']), ['/a']);
}
});
});
......
......@@ -20,18 +20,18 @@ suite('Chokidar normalizeRoots', async () => {
function assertNormalizedRootPath(inputPaths: string[], expectedPaths: string[]) {
const requests = inputPaths.map(path => newRequest(path));
const actual = normalizeRoots(requests);
assert.deepEqual(Object.keys(actual).sort(), expectedPaths);
assert.deepStrictEqual(Object.keys(actual).sort(), expectedPaths);
}
function assertNormalizedRequests(inputRequests: IWatcherRequest[], expectedRequests: { [path: string]: IWatcherRequest[] }) {
const actual = normalizeRoots(inputRequests);
const actualPath = Object.keys(actual).sort();
const expectedPaths = Object.keys(expectedRequests).sort();
assert.deepEqual(actualPath, expectedPaths);
assert.deepStrictEqual(actualPath, expectedPaths);
for (let path of actualPath) {
let a = expectedRequests[path].sort((r1, r2) => r1.path.localeCompare(r2.path));
let e = expectedRequests[path].sort((r1, r2) => r1.path.localeCompare(r2.path));
assert.deepEqual(a, e);
assert.deepStrictEqual(a, e);
}
}
......
......@@ -19,7 +19,7 @@ suite('File Service', () => {
const resource = URI.parse('test://foo/bar');
const provider = new NullFileSystemProvider();
assert.equal(service.canHandleResource(resource), false);
assert.strictEqual(service.canHandleResource(resource), false);
const registrations: IFileSystemProviderRegistrationEvent[] = [];
service.onDidChangeFileSystemProviderRegistrations(e => {
......@@ -47,33 +47,33 @@ suite('File Service', () => {
await service.activateProvider('test');
assert.equal(service.canHandleResource(resource), true);
assert.strictEqual(service.canHandleResource(resource), true);
assert.equal(registrations.length, 1);
assert.equal(registrations[0].scheme, 'test');
assert.equal(registrations[0].added, true);
assert.strictEqual(registrations.length, 1);
assert.strictEqual(registrations[0].scheme, 'test');
assert.strictEqual(registrations[0].added, true);
assert.ok(registrationDisposable);
assert.equal(capabilityChanges.length, 0);
assert.strictEqual(capabilityChanges.length, 0);
provider.setCapabilities(FileSystemProviderCapabilities.FileFolderCopy);
assert.equal(capabilityChanges.length, 1);
assert.strictEqual(capabilityChanges.length, 1);
provider.setCapabilities(FileSystemProviderCapabilities.Readonly);
assert.equal(capabilityChanges.length, 2);
assert.strictEqual(capabilityChanges.length, 2);
await service.activateProvider('test');
assert.equal(callCount, 2); // activation is called again
assert.strictEqual(callCount, 2); // activation is called again
assert.equal(service.hasCapability(resource, FileSystemProviderCapabilities.Readonly), true);
assert.equal(service.hasCapability(resource, FileSystemProviderCapabilities.FileOpenReadWriteClose), false);
assert.strictEqual(service.hasCapability(resource, FileSystemProviderCapabilities.Readonly), true);
assert.strictEqual(service.hasCapability(resource, FileSystemProviderCapabilities.FileOpenReadWriteClose), false);
registrationDisposable!.dispose();
assert.equal(service.canHandleResource(resource), false);
assert.strictEqual(service.canHandleResource(resource), false);
assert.equal(registrations.length, 2);
assert.equal(registrations[1].scheme, 'test');
assert.equal(registrations[1].added, false);
assert.strictEqual(registrations.length, 2);
assert.strictEqual(registrations[1].scheme, 'test');
assert.strictEqual(registrations[1].added, false);
});
test('watch', async () => {
......@@ -91,9 +91,9 @@ suite('File Service', () => {
const watcher1Disposable = service.watch(resource1);
await timeout(0); // service.watch() is async
assert.equal(disposeCounter, 0);
assert.strictEqual(disposeCounter, 0);
watcher1Disposable.dispose();
assert.equal(disposeCounter, 1);
assert.strictEqual(disposeCounter, 1);
disposeCounter = 0;
const resource2 = URI.parse('test://foo/bar2');
......@@ -102,13 +102,13 @@ suite('File Service', () => {
const watcher2Disposable3 = service.watch(resource2);
await timeout(0); // service.watch() is async
assert.equal(disposeCounter, 0);
assert.strictEqual(disposeCounter, 0);
watcher2Disposable1.dispose();
assert.equal(disposeCounter, 0);
assert.strictEqual(disposeCounter, 0);
watcher2Disposable2.dispose();
assert.equal(disposeCounter, 0);
assert.strictEqual(disposeCounter, 0);
watcher2Disposable3.dispose();
assert.equal(disposeCounter, 1);
assert.strictEqual(disposeCounter, 1);
disposeCounter = 0;
const resource3 = URI.parse('test://foo/bar3');
......@@ -116,10 +116,10 @@ suite('File Service', () => {
const watcher3Disposable2 = service.watch(resource3, { recursive: true, excludes: [] });
await timeout(0); // service.watch() is async
assert.equal(disposeCounter, 0);
assert.strictEqual(disposeCounter, 0);
watcher3Disposable1.dispose();
assert.equal(disposeCounter, 1);
assert.strictEqual(disposeCounter, 1);
watcher3Disposable2.dispose();
assert.equal(disposeCounter, 2);
assert.strictEqual(disposeCounter, 2);
});
});
......@@ -64,7 +64,7 @@ suite('Normalizer', () => {
watch.onDidFilesChange(e => {
assert.ok(e);
assert.equal(e.changes.length, 3);
assert.strictEqual(e.changes.length, 3);
assert.ok(e.contains(added, FileChangeType.ADDED));
assert.ok(e.contains(updated, FileChangeType.UPDATED));
assert.ok(e.contains(deleted, FileChangeType.DELETED));
......@@ -103,7 +103,7 @@ suite('Normalizer', () => {
watch.onDidFilesChange(e => {
assert.ok(e);
assert.equal(e.changes.length, 5);
assert.strictEqual(e.changes.length, 5);
assert.ok(e.contains(deletedFolderA, FileChangeType.DELETED));
assert.ok(e.contains(deletedFolderB, FileChangeType.DELETED));
......@@ -133,7 +133,7 @@ suite('Normalizer', () => {
watch.onDidFilesChange(e => {
assert.ok(e);
assert.equal(e.changes.length, 1);
assert.strictEqual(e.changes.length, 1);
assert.ok(e.contains(unrelated, FileChangeType.UPDATED));
......@@ -158,7 +158,7 @@ suite('Normalizer', () => {
watch.onDidFilesChange(e => {
assert.ok(e);
assert.equal(e.changes.length, 2);
assert.strictEqual(e.changes.length, 2);
assert.ok(e.contains(deleted, FileChangeType.UPDATED));
assert.ok(e.contains(unrelated, FileChangeType.UPDATED));
......@@ -184,7 +184,7 @@ suite('Normalizer', () => {
watch.onDidFilesChange(e => {
assert.ok(e);
assert.equal(e.changes.length, 2);
assert.strictEqual(e.changes.length, 2);
assert.ok(e.contains(created, FileChangeType.ADDED));
assert.ok(!e.contains(created, FileChangeType.UPDATED));
......@@ -213,7 +213,7 @@ suite('Normalizer', () => {
watch.onDidFilesChange(e => {
assert.ok(e);
assert.equal(e.changes.length, 2);
assert.strictEqual(e.changes.length, 2);
assert.ok(e.contains(deleted, FileChangeType.DELETED));
assert.ok(!e.contains(updated, FileChangeType.UPDATED));
......
......@@ -31,10 +31,10 @@ flakySuite('StateService', () => {
let service = new FileStorage(storageFile, () => null);
service.setItem('some.key', 'some.value');
assert.equal(service.getItem('some.key'), 'some.value');
assert.strictEqual(service.getItem('some.key'), 'some.value');
service.removeItem('some.key');
assert.equal(service.getItem('some.key', 'some.default'), 'some.default');
assert.strictEqual(service.getItem('some.key', 'some.default'), 'some.default');
assert.ok(!service.getItem('some.unknonw.key'));
......@@ -42,15 +42,15 @@ flakySuite('StateService', () => {
service = new FileStorage(storageFile, () => null);
assert.equal(service.getItem('some.other.key'), 'some.other.value');
assert.strictEqual(service.getItem('some.other.key'), 'some.other.value');
service.setItem('some.other.key', 'some.other.value');
assert.equal(service.getItem('some.other.key'), 'some.other.value');
assert.strictEqual(service.getItem('some.other.key'), 'some.other.value');
service.setItem('some.undefined.key', undefined);
assert.equal(service.getItem('some.undefined.key', 'some.default'), 'some.default');
assert.strictEqual(service.getItem('some.undefined.key', 'some.default'), 'some.default');
service.setItem('some.null.key', null);
assert.equal(service.getItem('some.null.key', 'some.default'), 'some.default');
assert.strictEqual(service.getItem('some.null.key', 'some.default'), 'some.default');
});
});
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { strictEqual, ok, equal } from 'assert';
import { strictEqual, ok } from 'assert';
import { StorageScope, InMemoryStorageService, StorageTarget, IStorageValueChangeEvent, IStorageTargetChangeEvent } from 'vs/platform/storage/common/storage';
suite('StorageService', function () {
......@@ -32,15 +32,15 @@ suite('StorageService', function () {
storage.store('test.get', 'foobar', scope, StorageTarget.MACHINE);
strictEqual(storage.get('test.get', scope, (undefined)!), 'foobar');
let storageValueChangeEvent = storageValueChangeEvents.find(e => e.key === 'test.get');
equal(storageValueChangeEvent?.scope, scope);
equal(storageValueChangeEvent?.key, 'test.get');
strictEqual(storageValueChangeEvent?.scope, scope);
strictEqual(storageValueChangeEvent?.key, 'test.get');
storageValueChangeEvents = [];
storage.store('test.get', '', scope, StorageTarget.MACHINE);
strictEqual(storage.get('test.get', scope, (undefined)!), '');
storageValueChangeEvent = storageValueChangeEvents.find(e => e.key === 'test.get');
equal(storageValueChangeEvent!.scope, scope);
equal(storageValueChangeEvent!.key, 'test.get');
strictEqual(storageValueChangeEvent!.scope, scope);
strictEqual(storageValueChangeEvent!.key, 'test.get');
storage.store('test.getNumber', 5, scope, StorageTarget.MACHINE);
strictEqual(storage.getNumber('test.getNumber', scope, (undefined)!), 5);
......@@ -79,8 +79,8 @@ suite('StorageService', function () {
storage.remove('test.remove', scope);
ok(!storage.get('test.remove', scope, (undefined)!));
let storageValueChangeEvent = storageValueChangeEvents.find(e => e.key === 'test.remove');
equal(storageValueChangeEvent?.scope, scope);
equal(storageValueChangeEvent?.key, 'test.remove');
strictEqual(storageValueChangeEvent?.scope, scope);
strictEqual(storageValueChangeEvent?.key, 'test.remove');
}
test('Keys (in-memory)', () => {
......@@ -107,20 +107,20 @@ suite('StorageService', function () {
storage.store('test.target1', 'value1', scope, target);
strictEqual(storage.keys(scope, target).length, 1);
equal(storageTargetEvent?.scope, scope);
equal(storageValueChangeEvent?.key, 'test.target1');
equal(storageValueChangeEvent?.scope, scope);
equal(storageValueChangeEvent?.target, target);
strictEqual(storageTargetEvent?.scope, scope);
strictEqual(storageValueChangeEvent?.key, 'test.target1');
strictEqual(storageValueChangeEvent?.scope, scope);
strictEqual(storageValueChangeEvent?.target, target);
storageTargetEvent = undefined;
storageValueChangeEvent = Object.create(null);
storage.store('test.target1', 'otherValue1', scope, target);
strictEqual(storage.keys(scope, target).length, 1);
equal(storageTargetEvent, undefined);
equal(storageValueChangeEvent?.key, 'test.target1');
equal(storageValueChangeEvent?.scope, scope);
equal(storageValueChangeEvent?.target, target);
strictEqual(storageTargetEvent, undefined);
strictEqual(storageValueChangeEvent?.key, 'test.target1');
strictEqual(storageValueChangeEvent?.scope, scope);
strictEqual(storageValueChangeEvent?.target, target);
storage.store('test.target2', 'value2', scope, target);
storage.store('test.target3', 'value3', scope, target);
......@@ -142,9 +142,9 @@ suite('StorageService', function () {
storage.remove('test.target4', scope);
strictEqual(storage.keys(scope, target).length, keysLength);
equal(storageTargetEvent?.scope, scope);
equal(storageValueChangeEvent?.key, 'test.target4');
equal(storageValueChangeEvent?.scope, scope);
strictEqual(storageTargetEvent?.scope, scope);
strictEqual(storageValueChangeEvent?.key, 'test.target4');
strictEqual(storageValueChangeEvent?.scope, scope);
}
}
......@@ -171,7 +171,7 @@ suite('StorageService', function () {
storage.store('test.target1', undefined, scope, target);
strictEqual(storage.keys(scope, target).length, 0);
equal(storageTargetEvent?.scope, scope);
strictEqual(storageTargetEvent?.scope, scope);
storage.store('test.target1', '', scope, target);
strictEqual(storage.keys(scope, target).length, 1);
......
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { equal } from 'assert';
import { strictEqual } from 'assert';
import { FileStorageDatabase } from 'vs/platform/storage/browser/storageService';
import { join } from 'vs/base/common/path';
import { tmpdir } from 'os';
......@@ -54,9 +54,9 @@ suite('Storage', () => {
storage.set('barNumber', 55);
storage.set('barBoolean', true);
equal(storage.get('bar'), 'foo');
equal(storage.get('barNumber'), '55');
equal(storage.get('barBoolean'), 'true');
strictEqual(storage.get('bar'), 'foo');
strictEqual(storage.get('barNumber'), '55');
strictEqual(storage.get('barBoolean'), 'true');
await storage.close();
......@@ -64,17 +64,17 @@ suite('Storage', () => {
await storage.init();
equal(storage.get('bar'), 'foo');
equal(storage.get('barNumber'), '55');
equal(storage.get('barBoolean'), 'true');
strictEqual(storage.get('bar'), 'foo');
strictEqual(storage.get('barNumber'), '55');
strictEqual(storage.get('barBoolean'), 'true');
storage.delete('bar');
storage.delete('barNumber');
storage.delete('barBoolean');
equal(storage.get('bar', 'undefined'), 'undefined');
equal(storage.get('barNumber', 'undefinedNumber'), 'undefinedNumber');
equal(storage.get('barBoolean', 'undefinedBoolean'), 'undefinedBoolean');
strictEqual(storage.get('bar', 'undefined'), 'undefined');
strictEqual(storage.get('barNumber', 'undefinedNumber'), 'undefinedNumber');
strictEqual(storage.get('barBoolean', 'undefinedBoolean'), 'undefinedBoolean');
await storage.close();
......@@ -82,8 +82,8 @@ suite('Storage', () => {
await storage.init();
equal(storage.get('bar', 'undefined'), 'undefined');
equal(storage.get('barNumber', 'undefinedNumber'), 'undefinedNumber');
equal(storage.get('barBoolean', 'undefinedBoolean'), 'undefinedBoolean');
strictEqual(storage.get('bar', 'undefined'), 'undefined');
strictEqual(storage.get('barNumber', 'undefinedNumber'), 'undefinedNumber');
strictEqual(storage.get('barBoolean', 'undefinedBoolean'), 'undefinedBoolean');
});
});
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { equal } from 'assert';
import { strictEqual } from 'assert';
import { StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { NativeStorageService } from 'vs/platform/storage/node/storageService';
import { tmpdir } from 'os';
......@@ -53,15 +53,15 @@ flakySuite('NativeStorageService', function () {
storage.store('barNumber', 55, StorageScope.WORKSPACE, StorageTarget.MACHINE);
storage.store('barBoolean', true, StorageScope.GLOBAL, StorageTarget.MACHINE);
equal(storage.get('bar', StorageScope.WORKSPACE), 'foo');
equal(storage.getNumber('barNumber', StorageScope.WORKSPACE), 55);
equal(storage.getBoolean('barBoolean', StorageScope.GLOBAL), true);
strictEqual(storage.get('bar', StorageScope.WORKSPACE), 'foo');
strictEqual(storage.getNumber('barNumber', StorageScope.WORKSPACE), 55);
strictEqual(storage.getBoolean('barBoolean', StorageScope.GLOBAL), true);
await storage.migrate({ id: String(Date.now() + 100) });
equal(storage.get('bar', StorageScope.WORKSPACE), 'foo');
equal(storage.getNumber('barNumber', StorageScope.WORKSPACE), 55);
equal(storage.getBoolean('barBoolean', StorageScope.GLOBAL), true);
strictEqual(storage.get('bar', StorageScope.WORKSPACE), 'foo');
strictEqual(storage.getNumber('barNumber', StorageScope.WORKSPACE), 55);
strictEqual(storage.getBoolean('barBoolean', StorageScope.GLOBAL), true);
await storage.close();
});
......
......@@ -88,22 +88,22 @@ suite('WindowsFinder', () => {
});
test('Existing window with folder', () => {
assert.equal(findWindowOnFile(windows, URI.file(path.join(fixturesFolder, 'no_vscode_folder', 'file.txt')), localWorkspaceResolver), noVscodeFolderWindow);
assert.strictEqual(findWindowOnFile(windows, URI.file(path.join(fixturesFolder, 'no_vscode_folder', 'file.txt')), localWorkspaceResolver), noVscodeFolderWindow);
assert.equal(findWindowOnFile(windows, URI.file(path.join(fixturesFolder, 'vscode_folder', 'file.txt')), localWorkspaceResolver), vscodeFolderWindow);
assert.strictEqual(findWindowOnFile(windows, URI.file(path.join(fixturesFolder, 'vscode_folder', 'file.txt')), localWorkspaceResolver), vscodeFolderWindow);
const window: ICodeWindow = createTestCodeWindow({ lastFocusTime: 1, openedFolderUri: URI.file(path.join(fixturesFolder, 'vscode_folder', 'nested_folder')) });
assert.equal(findWindowOnFile([window], URI.file(path.join(fixturesFolder, 'vscode_folder', 'nested_folder', 'subfolder', 'file.txt')), localWorkspaceResolver), window);
assert.strictEqual(findWindowOnFile([window], URI.file(path.join(fixturesFolder, 'vscode_folder', 'nested_folder', 'subfolder', 'file.txt')), localWorkspaceResolver), window);
});
test('More specific existing window wins', () => {
const window: ICodeWindow = createTestCodeWindow({ lastFocusTime: 2, openedFolderUri: URI.file(path.join(fixturesFolder, 'no_vscode_folder')) });
const nestedFolderWindow: ICodeWindow = createTestCodeWindow({ lastFocusTime: 1, openedFolderUri: URI.file(path.join(fixturesFolder, 'no_vscode_folder', 'nested_folder')) });
assert.equal(findWindowOnFile([window, nestedFolderWindow], URI.file(path.join(fixturesFolder, 'no_vscode_folder', 'nested_folder', 'subfolder', 'file.txt')), localWorkspaceResolver), nestedFolderWindow);
assert.strictEqual(findWindowOnFile([window, nestedFolderWindow], URI.file(path.join(fixturesFolder, 'no_vscode_folder', 'nested_folder', 'subfolder', 'file.txt')), localWorkspaceResolver), nestedFolderWindow);
});
test('Workspace folder wins', () => {
const window: ICodeWindow = createTestCodeWindow({ lastFocusTime: 1, openedWorkspace: testWorkspace });
assert.equal(findWindowOnFile([window], URI.file(path.join(fixturesFolder, 'vscode_workspace_2_folder', 'nested_vscode_folder', 'subfolder', 'file.txt')), localWorkspaceResolver), window);
assert.strictEqual(findWindowOnFile([window], URI.file(path.join(fixturesFolder, 'vscode_workspace_2_folder', 'nested_vscode_folder', 'subfolder', 'file.txt')), localWorkspaceResolver), window);
});
});
......@@ -28,15 +28,15 @@ function toWorkspace(uri: URI): IWorkspaceIdentifier {
};
}
function assertEqualURI(u1: URI | undefined, u2: URI | undefined, message?: string): void {
assert.equal(u1 && u1.toString(), u2 && u2.toString(), message);
assert.strictEqual(u1 && u1.toString(), u2 && u2.toString(), message);
}
function assertEqualWorkspace(w1: IWorkspaceIdentifier | undefined, w2: IWorkspaceIdentifier | undefined, message?: string): void {
if (!w1 || !w2) {
assert.equal(w1, w2, message);
assert.strictEqual(w1, w2, message);
return;
}
assert.equal(w1.id, w2.id, message);
assert.strictEqual(w1.id, w2.id, message);
assertEqualURI(w1.configPath, w2.configPath, message);
}
......@@ -45,9 +45,9 @@ function assertEqualWindowState(expected: IWindowState | undefined, actual: IWin
assert.deepEqual(expected, actual, message);
return;
}
assert.equal(expected.backupPath, actual.backupPath, message);
assert.strictEqual(expected.backupPath, actual.backupPath, message);
assertEqualURI(expected.folderUri, actual.folderUri, message);
assert.equal(expected.remoteAuthority, actual.remoteAuthority, message);
assert.strictEqual(expected.remoteAuthority, actual.remoteAuthority, message);
assertEqualWorkspace(expected.workspace, actual.workspace, message);
assert.deepEqual(expected.uiState, actual.uiState, message);
}
......@@ -55,7 +55,7 @@ function assertEqualWindowState(expected: IWindowState | undefined, actual: IWin
function assertEqualWindowsState(expected: IWindowsState, actual: IWindowsState, message?: string) {
assertEqualWindowState(expected.lastPluginDevelopmentHostWindow, actual.lastPluginDevelopmentHostWindow, message);
assertEqualWindowState(expected.lastActiveWindow, actual.lastActiveWindow, message);
assert.equal(expected.openedWindows.length, actual.openedWindows.length, message);
assert.strictEqual(expected.openedWindows.length, actual.openedWindows.length, message);
for (let i = 0; i < expected.openedWindows.length; i++) {
assertEqualWindowState(expected.openedWindows[i], actual.openedWindows[i], message);
}
......
......@@ -17,25 +17,25 @@ function toWorkspace(uri: URI): IWorkspaceIdentifier {
};
}
function assertEqualURI(u1: URI | undefined, u2: URI | undefined, message?: string): void {
assert.equal(u1 && u1.toString(), u2 && u2.toString(), message);
assert.strictEqual(u1 && u1.toString(), u2 && u2.toString(), message);
}
function assertEqualWorkspace(w1: IWorkspaceIdentifier | undefined, w2: IWorkspaceIdentifier | undefined, message?: string): void {
if (!w1 || !w2) {
assert.equal(w1, w2, message);
assert.strictEqual(w1, w2, message);
return;
}
assert.equal(w1.id, w2.id, message);
assert.strictEqual(w1.id, w2.id, message);
assertEqualURI(w1.configPath, w2.configPath, message);
}
function assertEqualRecentlyOpened(actual: IRecentlyOpened, expected: IRecentlyOpened, message?: string) {
assert.equal(actual.files.length, expected.files.length, message);
assert.strictEqual(actual.files.length, expected.files.length, message);
for (let i = 0; i < actual.files.length; i++) {
assertEqualURI(actual.files[i].fileUri, expected.files[i].fileUri, message);
assert.equal(actual.files[i].label, expected.files[i].label);
assert.strictEqual(actual.files[i].label, expected.files[i].label);
}
assert.equal(actual.workspaces.length, expected.workspaces.length, message);
assert.strictEqual(actual.workspaces.length, expected.workspaces.length, message);
for (let i = 0; i < actual.workspaces.length; i++) {
let expectedRecent = expected.workspaces[i];
let actualRecent = actual.workspaces[i];
......@@ -44,7 +44,7 @@ function assertEqualRecentlyOpened(actual: IRecentlyOpened, expected: IRecentlyO
} else {
assertEqualWorkspace(actualRecent.workspace, (<IRecentWorkspace>expectedRecent).workspace, message);
}
assert.equal(actualRecent.label, expectedRecent.label);
assert.strictEqual(actualRecent.label, expectedRecent.label);
}
}
......
......@@ -162,11 +162,11 @@ suite('WorkspacesManagementMainService', () => {
p2 = normalizeDriveLetter(p2);
}
assert.equal(p1, p2);
assert.strictEqual(p1, p2);
}
function assertEqualURI(u1: URI, u2: URI): void {
assert.equal(u1.toString(), u2.toString());
assert.strictEqual(u1.toString(), u2.toString());
}
test('createWorkspace (folders)', async () => {
......@@ -176,7 +176,7 @@ suite('WorkspacesManagementMainService', () => {
assert.ok(service.isUntitledWorkspace(workspace));
const ws = (JSON.parse(fs.readFileSync(workspace.configPath.fsPath).toString()) as IStoredWorkspace);
assert.equal(ws.folders.length, 2);
assert.strictEqual(ws.folders.length, 2);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[0]).name);
......@@ -190,11 +190,11 @@ suite('WorkspacesManagementMainService', () => {
assert.ok(service.isUntitledWorkspace(workspace));
const ws = (JSON.parse(fs.readFileSync(workspace.configPath.fsPath).toString()) as IStoredWorkspace);
assert.equal(ws.folders.length, 2);
assert.strictEqual(ws.folders.length, 2);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).name, 'currentworkingdirectory');
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).name, 'tempdir');
assert.strictEqual((<IRawFileWorkspaceFolder>ws.folders[0]).name, 'currentworkingdirectory');
assert.strictEqual((<IRawFileWorkspaceFolder>ws.folders[1]).name, 'tempdir');
});
test('createUntitledWorkspace (folders as other resource URIs)', async () => {
......@@ -207,12 +207,12 @@ suite('WorkspacesManagementMainService', () => {
assert.ok(service.isUntitledWorkspace(workspace));
const ws = (JSON.parse(fs.readFileSync(workspace.configPath.fsPath).toString()) as IStoredWorkspace);
assert.equal(ws.folders.length, 2);
assert.equal((<IRawUriWorkspaceFolder>ws.folders[0]).uri, folder1URI.toString(true));
assert.equal((<IRawUriWorkspaceFolder>ws.folders[1]).uri, folder2URI.toString(true));
assert.strictEqual(ws.folders.length, 2);
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[0]).uri, folder1URI.toString(true));
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[1]).uri, folder2URI.toString(true));
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[0]).name);
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[1]).name);
assert.equal(ws.remoteAuthority, 'server');
assert.strictEqual(ws.remoteAuthority, 'server');
});
test('createWorkspaceSync (folders)', () => {
......@@ -222,7 +222,7 @@ suite('WorkspacesManagementMainService', () => {
assert.ok(service.isUntitledWorkspace(workspace));
const ws = JSON.parse(fs.readFileSync(workspace.configPath.fsPath).toString()) as IStoredWorkspace;
assert.equal(ws.folders.length, 2);
assert.strictEqual(ws.folders.length, 2);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
......@@ -237,12 +237,12 @@ suite('WorkspacesManagementMainService', () => {
assert.ok(service.isUntitledWorkspace(workspace));
const ws = JSON.parse(fs.readFileSync(workspace.configPath.fsPath).toString()) as IStoredWorkspace;
assert.equal(ws.folders.length, 2);
assert.strictEqual(ws.folders.length, 2);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, process.cwd());
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, os.tmpdir());
assert.equal((<IRawFileWorkspaceFolder>ws.folders[0]).name, 'currentworkingdirectory');
assert.equal((<IRawFileWorkspaceFolder>ws.folders[1]).name, 'tempdir');
assert.strictEqual((<IRawFileWorkspaceFolder>ws.folders[0]).name, 'currentworkingdirectory');
assert.strictEqual((<IRawFileWorkspaceFolder>ws.folders[1]).name, 'tempdir');
});
test('createUntitledWorkspaceSync (folders as other resource URIs)', () => {
......@@ -255,9 +255,9 @@ suite('WorkspacesManagementMainService', () => {
assert.ok(service.isUntitledWorkspace(workspace));
const ws = JSON.parse(fs.readFileSync(workspace.configPath.fsPath).toString()) as IStoredWorkspace;
assert.equal(ws.folders.length, 2);
assert.equal((<IRawUriWorkspaceFolder>ws.folders[0]).uri, folder1URI.toString(true));
assert.equal((<IRawUriWorkspaceFolder>ws.folders[1]).uri, folder2URI.toString(true));
assert.strictEqual(ws.folders.length, 2);
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[0]).uri, folder1URI.toString(true));
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[1]).uri, folder2URI.toString(true));
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[0]).name);
assert.ok(!(<IRawFileWorkspaceFolder>ws.folders[1]).name);
......@@ -273,7 +273,7 @@ suite('WorkspacesManagementMainService', () => {
workspace.configPath = URI.file(newPath);
const resolved = service.resolveLocalWorkspaceSync(workspace.configPath);
assert.equal(2, resolved!.folders.length);
assert.strictEqual(2, resolved!.folders.length);
assertEqualURI(resolved!.configPath, workspace.configPath);
assert.ok(resolved!.id);
fs.writeFileSync(workspace.configPath.fsPath, JSON.stringify({ something: 'something' })); // invalid workspace
......@@ -327,7 +327,7 @@ suite('WorkspacesManagementMainService', () => {
let workspaceConfigPath = URI.file(path.join(tmpDir, 'inside', 'myworkspace1.code-workspace'));
let newContent = rewriteWorkspaceFileForNewLocation(origContent, origConfigPath, false, workspaceConfigPath, extUriBiasedIgnorePathCase);
let ws = (JSON.parse(newContent) as IStoredWorkspace);
assert.equal(ws.folders.length, 3);
assert.strictEqual(ws.folders.length, 3);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, folder1); // absolute path because outside of tmpdir
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, '.');
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[2]).path, 'somefolder');
......@@ -336,7 +336,7 @@ suite('WorkspacesManagementMainService', () => {
workspaceConfigPath = URI.file(path.join(tmpDir, 'myworkspace2.code-workspace'));
newContent = rewriteWorkspaceFileForNewLocation(newContent, origConfigPath, false, workspaceConfigPath, extUriBiasedIgnorePathCase);
ws = (JSON.parse(newContent) as IStoredWorkspace);
assert.equal(ws.folders.length, 3);
assert.strictEqual(ws.folders.length, 3);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, folder1);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, 'inside');
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[2]).path, isWindows ? 'inside\\somefolder' : 'inside/somefolder');
......@@ -345,7 +345,7 @@ suite('WorkspacesManagementMainService', () => {
workspaceConfigPath = URI.file(path.join(tmpDir, 'other', 'myworkspace2.code-workspace'));
newContent = rewriteWorkspaceFileForNewLocation(newContent, origConfigPath, false, workspaceConfigPath, extUriBiasedIgnorePathCase);
ws = (JSON.parse(newContent) as IStoredWorkspace);
assert.equal(ws.folders.length, 3);
assert.strictEqual(ws.folders.length, 3);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[0]).path, folder1);
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[1]).path, isWindows ? '..\\inside' : '../inside');
assertPathEquals((<IRawFileWorkspaceFolder>ws.folders[2]).path, isWindows ? '..\\inside\\somefolder' : '../inside/somefolder');
......@@ -354,10 +354,10 @@ suite('WorkspacesManagementMainService', () => {
workspaceConfigPath = URI.parse('foo://foo/bar/myworkspace2.code-workspace');
newContent = rewriteWorkspaceFileForNewLocation(newContent, origConfigPath, false, workspaceConfigPath, extUriBiasedIgnorePathCase);
ws = (JSON.parse(newContent) as IStoredWorkspace);
assert.equal(ws.folders.length, 3);
assert.equal((<IRawUriWorkspaceFolder>ws.folders[0]).uri, URI.file(folder1).toString(true));
assert.equal((<IRawUriWorkspaceFolder>ws.folders[1]).uri, URI.file(tmpInsideDir).toString(true));
assert.equal((<IRawUriWorkspaceFolder>ws.folders[2]).uri, URI.file(path.join(tmpInsideDir, 'somefolder')).toString(true));
assert.strictEqual(ws.folders.length, 3);
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[0]).uri, URI.file(folder1).toString(true));
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[1]).uri, URI.file(tmpInsideDir).toString(true));
assert.strictEqual((<IRawUriWorkspaceFolder>ws.folders[2]).uri, URI.file(path.join(tmpInsideDir, 'somefolder')).toString(true));
fs.unlinkSync(firstConfigPath);
});
......@@ -370,7 +370,7 @@ suite('WorkspacesManagementMainService', () => {
origContent = `// this is a comment\n${origContent}`;
let newContent = rewriteWorkspaceFileForNewLocation(origContent, workspace.configPath, false, workspaceConfigPath, extUriBiasedIgnorePathCase);
assert.equal(0, newContent.indexOf('// this is a comment'));
assert.strictEqual(0, newContent.indexOf('// this is a comment'));
service.deleteUntitledWorkspaceSync(workspace);
});
......@@ -419,14 +419,14 @@ suite('WorkspacesManagementMainService', () => {
test('getUntitledWorkspaceSync', async function () {
let untitled = service.getUntitledWorkspacesSync();
assert.equal(untitled.length, 0);
assert.strictEqual(untitled.length, 0);
const untitledOne = await createUntitledWorkspace([process.cwd(), os.tmpdir()]);
assert.ok(fs.existsSync(untitledOne.configPath.fsPath));
untitled = service.getUntitledWorkspacesSync();
assert.equal(1, untitled.length);
assert.equal(untitledOne.id, untitled[0].workspace.id);
assert.strictEqual(1, untitled.length);
assert.strictEqual(untitledOne.id, untitled[0].workspace.id);
const untitledTwo = await createUntitledWorkspace([os.tmpdir(), process.cwd()]);
assert.ok(fs.existsSync(untitledTwo.configPath.fsPath));
......@@ -438,15 +438,15 @@ suite('WorkspacesManagementMainService', () => {
if (untitled.length === 1) {
assert.fail(`Unexpected workspaces count of 1 (expected 2), all workspaces:\n ${fs.readdirSync(untitledHome.fsPath).map(name => fs.readFileSync(joinPath(untitledHome, name, 'workspace.json').fsPath, 'utf8'))}, before getUntitledWorkspacesSync: ${beforeGettingUntitledWorkspaces}`);
}
assert.equal(2, untitled.length);
assert.strictEqual(2, untitled.length);
service.deleteUntitledWorkspaceSync(untitledOne);
untitled = service.getUntitledWorkspacesSync();
assert.equal(1, untitled.length);
assert.strictEqual(1, untitled.length);
service.deleteUntitledWorkspaceSync(untitledTwo);
untitled = service.getUntitledWorkspacesSync();
assert.equal(0, untitled.length);
assert.strictEqual(0, untitled.length);
});
test('getSingleWorkspaceIdentifier', async function () {
......
......@@ -62,7 +62,7 @@ suite('BackupRestorer', () => {
// Verify backups restored and opened as dirty
await restorer.doRestoreBackups();
assert.equal(editorService.count, 4);
assert.strictEqual(editorService.count, 4);
assert.ok(editorService.editors.every(editor => editor.isDirty()));
let counter = 0;
......@@ -101,7 +101,7 @@ suite('BackupRestorer', () => {
}
}
assert.equal(counter, 4);
assert.strictEqual(counter, 4);
part.dispose();
tracker.dispose();
......
......@@ -86,13 +86,13 @@ suite('BackupTracker (browser)', function () {
await backupFileService.joinBackupResource();
assert.equal(backupFileService.hasBackupSync(untitledEditor.resource), true);
assert.strictEqual(backupFileService.hasBackupSync(untitledEditor.resource), true);
untitledModel.dispose();
await backupFileService.joinDiscardBackup();
assert.equal(backupFileService.hasBackupSync(untitledEditor.resource), false);
assert.strictEqual(backupFileService.hasBackupSync(untitledEditor.resource), false);
cleanup();
}
......@@ -131,23 +131,23 @@ suite('BackupTracker (browser)', function () {
// Normal
customWorkingCopy.setDirty(true);
await backupFileService.joinBackupResource();
assert.equal(backupFileService.hasBackupSync(resource), true);
assert.strictEqual(backupFileService.hasBackupSync(resource), true);
customWorkingCopy.setDirty(false);
customWorkingCopy.setDirty(true);
await backupFileService.joinBackupResource();
assert.equal(backupFileService.hasBackupSync(resource), true);
assert.strictEqual(backupFileService.hasBackupSync(resource), true);
customWorkingCopy.setDirty(false);
await backupFileService.joinDiscardBackup();
assert.equal(backupFileService.hasBackupSync(resource), false);
assert.strictEqual(backupFileService.hasBackupSync(resource), false);
// Cancellation
customWorkingCopy.setDirty(true);
await timeout(0);
customWorkingCopy.setDirty(false);
await backupFileService.joinDiscardBackup();
assert.equal(backupFileService.hasBackupSync(resource), false);
assert.strictEqual(backupFileService.hasBackupSync(resource), false);
customWorkingCopy.dispose();
await cleanup();
......
......@@ -183,13 +183,13 @@ flakySuite('BackupTracker (native)', function () {
await accessor.backupFileService.joinBackupResource();
assert.equal(accessor.backupFileService.hasBackupSync(resource), true);
assert.strictEqual(accessor.backupFileService.hasBackupSync(resource), true);
fileModel?.dispose();
await accessor.backupFileService.joinDiscardBackup();
assert.equal(accessor.backupFileService.hasBackupSync(resource), false);
assert.strictEqual(accessor.backupFileService.hasBackupSync(resource), false);
await cleanup();
});
......@@ -222,7 +222,7 @@ flakySuite('BackupTracker (native)', function () {
await model?.load();
model?.textEditorModel?.setValue('foo');
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
const event = new BeforeShutdownEventImpl();
accessor.lifecycleService.fireWillShutdown(event);
......@@ -243,7 +243,7 @@ flakySuite('BackupTracker (native)', function () {
await model?.load();
model?.textEditorModel?.setValue('foo');
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
const event = new BeforeShutdownEventImpl();
accessor.lifecycleService.fireWillShutdown(event);
......@@ -251,7 +251,7 @@ flakySuite('BackupTracker (native)', function () {
const veto = await event.value;
assert.ok(!veto);
assert.equal(accessor.workingCopyService.dirtyCount, 0);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 0);
await cleanup();
});
......@@ -269,7 +269,7 @@ flakySuite('BackupTracker (native)', function () {
await model?.load();
model?.textEditorModel?.setValue('foo');
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
const event = new BeforeShutdownEventImpl();
accessor.lifecycleService.fireWillShutdown(event);
......@@ -293,7 +293,7 @@ flakySuite('BackupTracker (native)', function () {
await model?.load();
model?.textEditorModel?.setValue('foo');
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
const event = new BeforeShutdownEventImpl();
accessor.lifecycleService.fireWillShutdown(event);
......@@ -433,15 +433,15 @@ flakySuite('BackupTracker (native)', function () {
await model?.load();
model?.textEditorModel?.setValue('foo');
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
const event = new BeforeShutdownEventImpl();
event.reason = shutdownReason;
accessor.lifecycleService.fireWillShutdown(event);
const veto = await event.value;
assert.equal(accessor.backupFileService.discardedBackups.length, 0); // When hot exit is set, backups should never be cleaned since the confirm result is cancel
assert.equal(veto, shouldVeto);
assert.strictEqual(accessor.backupFileService.discardedBackups.length, 0); // When hot exit is set, backups should never be cleaned since the confirm result is cancel
assert.strictEqual(veto, shouldVeto);
await cleanup();
}
......
......@@ -42,25 +42,25 @@ suite('Save Participants', function () {
let lineContent = '';
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), lineContent);
assert.strictEqual(snapshotToString(model.createSnapshot()!), lineContent);
// No new line if last line already empty
lineContent = `Hello New Line${model.textEditorModel.getEOL()}`;
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), lineContent);
assert.strictEqual(snapshotToString(model.createSnapshot()!), lineContent);
// New empty line added (single line)
lineContent = 'Hello New Line';
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), `${lineContent}${model.textEditorModel.getEOL()}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${lineContent}${model.textEditorModel.getEOL()}`);
// New empty line added (multi line)
lineContent = `Hello New Line${model.textEditorModel.getEOL()}Hello New Line${model.textEditorModel.getEOL()}Hello New Line`;
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), `${lineContent}${model.textEditorModel.getEOL()}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${lineContent}${model.textEditorModel.getEOL()}`);
});
test('trim final new lines', async function () {
......@@ -77,25 +77,25 @@ suite('Save Participants', function () {
let lineContent = `${textContent}`;
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), lineContent);
assert.strictEqual(snapshotToString(model.createSnapshot()!), lineContent);
// No new line removal if last line is single new line
lineContent = `${textContent}${eol}`;
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), lineContent);
assert.strictEqual(snapshotToString(model.createSnapshot()!), lineContent);
// Remove new line (single line with two new lines)
lineContent = `${textContent}${eol}${eol}`;
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
// Remove new lines (multiple lines with multiple new lines)
lineContent = `${textContent}${eol}${textContent}${eol}${eol}${eol}`;
model.textEditorModel.setValue(lineContent);
await participant.participate(model, { reason: SaveReason.EXPLICIT });
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}${eol}${textContent}${eol}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}${eol}${textContent}${eol}`);
});
test('trim final new lines bug#39750', async function () {
......@@ -117,12 +117,12 @@ suite('Save Participants', function () {
// undo
await model.textEditorModel.undo();
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}`);
// trim final new lines should not mess the undo stack
await participant.participate(model, { reason: SaveReason.EXPLICIT });
await model.textEditorModel.redo();
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}.`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}.`);
});
test('trim final new lines bug#46075', async function () {
......@@ -143,13 +143,13 @@ suite('Save Participants', function () {
}
// confirm trimming
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
// undo should go back to previous content immediately
await model.textEditorModel.undo();
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}${eol}${eol}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}${eol}${eol}`);
await model.textEditorModel.redo();
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
});
test('trim whitespace', async function () {
......@@ -169,6 +169,6 @@ suite('Save Participants', function () {
}
// confirm trimming
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}`);
assert.strictEqual(snapshotToString(model.createSnapshot()!), `${textContent}`);
});
});
......@@ -102,28 +102,28 @@ suite('Files - FileEditorInput', () => {
const preferredResource = toResource.call(this, '/foo/bar/UPDATEFILE.js');
const inputWithoutPreferredResource = createFileInput(resource);
assert.equal(inputWithoutPreferredResource.resource.toString(), resource.toString());
assert.equal(inputWithoutPreferredResource.preferredResource.toString(), resource.toString());
assert.strictEqual(inputWithoutPreferredResource.resource.toString(), resource.toString());
assert.strictEqual(inputWithoutPreferredResource.preferredResource.toString(), resource.toString());
const inputWithPreferredResource = createFileInput(resource, preferredResource);
assert.equal(inputWithPreferredResource.resource.toString(), resource.toString());
assert.equal(inputWithPreferredResource.preferredResource.toString(), preferredResource.toString());
assert.strictEqual(inputWithPreferredResource.resource.toString(), resource.toString());
assert.strictEqual(inputWithPreferredResource.preferredResource.toString(), preferredResource.toString());
let didChangeLabel = false;
const listener = inputWithPreferredResource.onDidChangeLabel(e => {
didChangeLabel = true;
});
assert.equal(inputWithPreferredResource.getName(), 'UPDATEFILE.js');
assert.strictEqual(inputWithPreferredResource.getName(), 'UPDATEFILE.js');
const otherPreferredResource = toResource.call(this, '/FOO/BAR/updateFILE.js');
inputWithPreferredResource.setPreferredResource(otherPreferredResource);
assert.equal(inputWithPreferredResource.resource.toString(), resource.toString());
assert.equal(inputWithPreferredResource.preferredResource.toString(), otherPreferredResource.toString());
assert.equal(inputWithPreferredResource.getName(), 'updateFILE.js');
assert.equal(didChangeLabel, true);
assert.strictEqual(inputWithPreferredResource.resource.toString(), resource.toString());
assert.strictEqual(inputWithPreferredResource.preferredResource.toString(), otherPreferredResource.toString());
assert.strictEqual(inputWithPreferredResource.getName(), 'updateFILE.js');
assert.strictEqual(didChangeLabel, true);
listener.dispose();
});
......@@ -135,20 +135,20 @@ suite('Files - FileEditorInput', () => {
});
const input = createFileInput(toResource.call(this, '/foo/bar/file.js'), undefined, mode);
assert.equal(input.getPreferredMode(), mode);
assert.strictEqual(input.getPreferredMode(), mode);
const model = await input.resolve() as TextFileEditorModel;
assert.equal(model.textEditorModel!.getModeId(), mode);
assert.strictEqual(model.textEditorModel!.getModeId(), mode);
input.setMode('text');
assert.equal(input.getPreferredMode(), 'text');
assert.equal(model.textEditorModel!.getModeId(), PLAINTEXT_MODE_ID);
assert.strictEqual(input.getPreferredMode(), 'text');
assert.strictEqual(model.textEditorModel!.getModeId(), PLAINTEXT_MODE_ID);
const input2 = createFileInput(toResource.call(this, '/foo/bar/file.js'));
input2.setPreferredMode(mode);
const model2 = await input2.resolve() as TextFileEditorModel;
assert.equal(model2.textEditorModel!.getModeId(), mode);
assert.strictEqual(model2.textEditorModel!.getModeId(), mode);
});
test('matches', function () {
......@@ -169,10 +169,10 @@ suite('Files - FileEditorInput', () => {
const input = createFileInput(toResource.call(this, '/foo/bar/updatefile.js'));
input.setEncoding('utf16', EncodingMode.Encode);
assert.equal(input.getEncoding(), 'utf16');
assert.strictEqual(input.getEncoding(), 'utf16');
const resolved = await input.resolve() as TextFileEditorModel;
assert.equal(input.getEncoding(), resolved.getEncoding());
assert.strictEqual(input.getEncoding(), resolved.getEncoding());
resolved.dispose();
});
......@@ -237,7 +237,7 @@ suite('Files - FileEditorInput', () => {
const model = await accessor.textFileService.files.resolve(input.resource);
model.textEditorModel?.setValue('hello world');
assert.equal(listenerCount, 1);
assert.strictEqual(listenerCount, 1);
assert.ok(input.isDirty());
input.dispose();
......@@ -269,7 +269,7 @@ suite('Files - FileEditorInput', () => {
assert.fail('File Editor Input Factory missing');
}
assert.equal(factory.canSerialize(input), true);
assert.strictEqual(factory.canSerialize(input), true);
const inputSerialized = factory.serialize(input);
if (!inputSerialized) {
......@@ -277,7 +277,7 @@ suite('Files - FileEditorInput', () => {
}
const inputDeserialized = factory.deserialize(instantiationService, inputSerialized);
assert.equal(input.matches(inputDeserialized), true);
assert.strictEqual(input.matches(inputDeserialized), true);
const preferredResource = toResource.call(this, '/foo/bar/UPDATEfile.js');
const inputWithPreferredResource = createFileInput(toResource.call(this, '/foo/bar/updatefile.js'), preferredResource);
......@@ -288,8 +288,8 @@ suite('Files - FileEditorInput', () => {
}
const inputWithPreferredResourceDeserialized = factory.deserialize(instantiationService, inputWithPreferredResourceSerialized) as FileEditorInput;
assert.equal(inputWithPreferredResource.resource.toString(), inputWithPreferredResourceDeserialized.resource.toString());
assert.equal(inputWithPreferredResource.preferredResource.toString(), inputWithPreferredResourceDeserialized.preferredResource.toString());
assert.strictEqual(inputWithPreferredResource.resource.toString(), inputWithPreferredResourceDeserialized.resource.toString());
assert.strictEqual(inputWithPreferredResource.preferredResource.toString(), inputWithPreferredResourceDeserialized.preferredResource.toString());
});
test('preferred name/description', async function () {
......@@ -302,16 +302,16 @@ suite('Files - FileEditorInput', () => {
didChangeLabelCounter++;
});
assert.equal(customFileInput.getName(), 'My Name');
assert.equal(customFileInput.getDescription(), 'My Description');
assert.strictEqual(customFileInput.getName(), 'My Name');
assert.strictEqual(customFileInput.getDescription(), 'My Description');
customFileInput.setPreferredName('My Name 2');
customFileInput.setPreferredDescription('My Description 2');
assert.equal(customFileInput.getName(), 'My Name 2');
assert.equal(customFileInput.getDescription(), 'My Description 2');
assert.strictEqual(customFileInput.getName(), 'My Name 2');
assert.strictEqual(customFileInput.getDescription(), 'My Description 2');
assert.equal(didChangeLabelCounter, 2);
assert.strictEqual(didChangeLabelCounter, 2);
customFileInput.dispose();
......@@ -332,7 +332,7 @@ suite('Files - FileEditorInput', () => {
assert.notEqual(fileInput.getName(), 'My Name 2');
assert.notEqual(fileInput.getDescription(), 'My Description 2');
assert.equal(didChangeLabelCounter, 0);
assert.strictEqual(didChangeLabelCounter, 0);
fileInput.dispose();
});
......
......@@ -27,8 +27,8 @@ suite('Files - FileOnDiskContentProvider', () => {
const content = await provider.provideTextContent(uri.with({ scheme: 'conflictResolution', query: JSON.stringify({ scheme: uri.scheme }) }));
assert.ok(content);
assert.equal(snapshotToString(content!.createSnapshot()), 'Hello Html');
assert.equal(accessor.fileService.getLastReadFileUri().scheme, uri.scheme);
assert.equal(accessor.fileService.getLastReadFileUri().path, uri.path);
assert.strictEqual(snapshotToString(content!.createSnapshot()), 'Hello Html');
assert.strictEqual(accessor.fileService.getLastReadFileUri().scheme, uri.scheme);
assert.strictEqual(accessor.fileService.getLastReadFileUri().path, uri.path);
});
});
......@@ -94,7 +94,7 @@ suite('Files - TextFileEditorTracker', () => {
const model = await accessor.textFileService.files.resolve(resource) as IResolvedTextFileEditorModel;
model.textEditorModel.setValue('Super Good');
assert.equal(snapshotToString(model.createSnapshot()!), 'Super Good');
assert.strictEqual(snapshotToString(model.createSnapshot()!), 'Super Good');
await model.save();
......@@ -103,7 +103,7 @@ suite('Files - TextFileEditorTracker', () => {
await timeout(0); // due to event updating model async
assert.equal(snapshotToString(model.createSnapshot()!), 'Hello Html');
assert.strictEqual(snapshotToString(model.createSnapshot()!), 'Hello Html');
tracker.dispose();
(<TextFileEditorModelManager>accessor.textFileService.files).dispose();
......
......@@ -48,7 +48,7 @@ suite('Files - TextFileEditorModel', () => {
await model.load();
assert.equal(onDidLoadCounter, 1);
assert.strictEqual(onDidLoadCounter, 1);
let onDidChangeContentCounter = 0;
model.onDidChangeContent(() => onDidChangeContentCounter++);
......@@ -58,17 +58,17 @@ suite('Files - TextFileEditorModel', () => {
model.updateTextEditorModel(createTextBufferFactory('bar'));
assert.equal(onDidChangeContentCounter, 1);
assert.equal(onDidChangeDirtyCounter, 1);
assert.strictEqual(onDidChangeContentCounter, 1);
assert.strictEqual(onDidChangeDirtyCounter, 1);
model.updateTextEditorModel(createTextBufferFactory('foo'));
assert.equal(onDidChangeContentCounter, 2);
assert.equal(onDidChangeDirtyCounter, 1);
assert.strictEqual(onDidChangeContentCounter, 2);
assert.strictEqual(onDidChangeDirtyCounter, 1);
await model.revert();
assert.equal(onDidChangeDirtyCounter, 2);
assert.strictEqual(onDidChangeDirtyCounter, 2);
model.dispose();
});
......@@ -76,7 +76,7 @@ suite('Files - TextFileEditorModel', () => {
test('isTextFileEditorModel', async function () {
const model = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/index_async.txt'), 'utf8', undefined);
assert.equal(isTextFileEditorModel(model), true);
assert.strictEqual(isTextFileEditorModel(model), true);
model.dispose();
});
......@@ -86,7 +86,7 @@ suite('Files - TextFileEditorModel', () => {
await model.load();
assert.equal(accessor.workingCopyService.dirtyCount, 0);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 0);
let savedEvent = false;
model.onDidSave(() => savedEvent = true);
......@@ -98,8 +98,8 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(getLastModifiedTime(model) <= Date.now());
assert.ok(model.hasState(TextFileEditorModelState.DIRTY));
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
let workingCopyEvent = false;
accessor.workingCopyService.onDidChangeDirty(e => {
......@@ -118,8 +118,8 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(savedEvent);
assert.ok(workingCopyEvent);
assert.equal(accessor.workingCopyService.dirtyCount, 0);
assert.equal(accessor.workingCopyService.isDirty(model.resource), false);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 0);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), false);
savedEvent = false;
......@@ -173,8 +173,8 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(model.isDirty());
assert.ok(saveErrorEvent);
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
} finally {
accessor.fileService.writeShouldThrowError = undefined;
}
......@@ -209,8 +209,8 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(model.isDirty());
assert.ok(saveErrorEvent);
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
model.dispose();
} finally {
......@@ -239,8 +239,8 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(model.isDirty());
assert.ok(saveErrorEvent);
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
model.dispose();
} finally {
......@@ -255,7 +255,7 @@ suite('Files - TextFileEditorModel', () => {
model.onDidChangeEncoding(() => encodingEvent = true);
model.setEncoding('utf8', EncodingMode.Encode); // no-op
assert.equal(getLastModifiedTime(model), -1);
assert.strictEqual(getLastModifiedTime(model), -1);
assert.ok(!encodingEvent);
......@@ -288,7 +288,7 @@ suite('Files - TextFileEditorModel', () => {
await model.load();
assert.equal(model.textEditorModel!.getModeId(), mode);
assert.strictEqual(model.textEditorModel!.getModeId(), mode);
model.dispose();
assert.ok(!accessor.modelService.getModel(model.resource));
......@@ -334,13 +334,13 @@ suite('Files - TextFileEditorModel', () => {
await model.load({ contents: createTextBufferFactory('Hello World') });
assert.equal(model.textEditorModel?.getValue(), 'Hello World');
assert.equal(model.isDirty(), true);
assert.strictEqual(model.textEditorModel?.getValue(), 'Hello World');
assert.strictEqual(model.isDirty(), true);
await model.load({ contents: createTextBufferFactory('Hello Changes') });
assert.equal(model.textEditorModel?.getValue(), 'Hello Changes');
assert.equal(model.isDirty(), true);
assert.strictEqual(model.textEditorModel?.getValue(), 'Hello Changes');
assert.strictEqual(model.isDirty(), true);
// verify that we do not mark the model as saved when undoing once because
// we never really had a saved state
......@@ -369,17 +369,17 @@ suite('Files - TextFileEditorModel', () => {
model.updateTextEditorModel(createTextBufferFactory('foo'));
assert.ok(model.isDirty());
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
await model.revert();
assert.strictEqual(model.isDirty(), false);
assert.equal(model.textEditorModel!.getValue(), 'Hello Html');
assert.equal(eventCounter, 1);
assert.strictEqual(model.textEditorModel!.getValue(), 'Hello Html');
assert.strictEqual(eventCounter, 1);
assert.ok(workingCopyEvent);
assert.equal(accessor.workingCopyService.dirtyCount, 0);
assert.equal(accessor.workingCopyService.isDirty(model.resource), false);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 0);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), false);
model.dispose();
});
......@@ -402,17 +402,17 @@ suite('Files - TextFileEditorModel', () => {
model.updateTextEditorModel(createTextBufferFactory('foo'));
assert.ok(model.isDirty());
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
await model.revert({ soft: true });
assert.strictEqual(model.isDirty(), false);
assert.equal(model.textEditorModel!.getValue(), 'foo');
assert.equal(eventCounter, 1);
assert.strictEqual(model.textEditorModel!.getValue(), 'foo');
assert.strictEqual(eventCounter, 1);
assert.ok(workingCopyEvent);
assert.equal(accessor.workingCopyService.dirtyCount, 0);
assert.equal(accessor.workingCopyService.isDirty(model.resource), false);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 0);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), false);
model.dispose();
});
......@@ -436,8 +436,8 @@ suite('Files - TextFileEditorModel', () => {
await model.textEditorModel!.undo();
assert.ok(model.isDirty());
assert.equal(accessor.workingCopyService.dirtyCount, 1);
assert.equal(accessor.workingCopyService.isDirty(model.resource), true);
assert.strictEqual(accessor.workingCopyService.dirtyCount, 1);
assert.strictEqual(accessor.workingCopyService.isDirty(model.resource), true);
});
test('Update Dirty', async function () {
......@@ -466,12 +466,12 @@ suite('Files - TextFileEditorModel', () => {
model.setDirty(true);
assert.ok(model.isDirty());
assert.equal(eventCounter, 1);
assert.strictEqual(eventCounter, 1);
assert.ok(workingCopyEvent);
model.setDirty(false);
assert.strictEqual(model.isDirty(), false);
assert.equal(eventCounter, 2);
assert.strictEqual(eventCounter, 2);
model.dispose();
});
......@@ -496,7 +496,7 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(!model.isDirty());
await model.save({ force: true });
assert.equal(saveEvent, false);
assert.strictEqual(saveEvent, false);
await model.revert({ soft: true });
assert.ok(!model.isDirty());
......@@ -517,7 +517,7 @@ suite('Files - TextFileEditorModel', () => {
model = await model.load() as TextFileEditorModel;
assert.ok(model);
assert.equal(getLastModifiedTime(model), mtime);
assert.strictEqual(getLastModifiedTime(model), mtime);
model.dispose();
});
......@@ -569,7 +569,7 @@ suite('Files - TextFileEditorModel', () => {
const model: TextFileEditorModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/index_async.txt'), 'utf8', undefined);
model.onDidSave(() => {
assert.equal(snapshotToString(model.createSnapshot()!), eventCounter === 1 ? 'bar' : 'foobar');
assert.strictEqual(snapshotToString(model.createSnapshot()!), eventCounter === 1 ? 'bar' : 'foobar');
assert.ok(!model.isDirty());
eventCounter++;
});
......@@ -588,14 +588,14 @@ suite('Files - TextFileEditorModel', () => {
assert.ok(model.isDirty());
await model.save();
assert.equal(eventCounter, 2);
assert.strictEqual(eventCounter, 2);
participant.dispose();
model.updateTextEditorModel(createTextBufferFactory('foobar'));
assert.ok(model.isDirty());
await model.save();
assert.equal(eventCounter, 3);
assert.strictEqual(eventCounter, 3);
model.dispose();
});
......@@ -614,7 +614,7 @@ suite('Files - TextFileEditorModel', () => {
model.updateTextEditorModel(createTextBufferFactory('foo'));
await model.save({ skipSaveParticipants: true });
assert.equal(eventCounter, 0);
assert.strictEqual(eventCounter, 0);
participant.dispose();
model.dispose();
......@@ -645,7 +645,7 @@ suite('Files - TextFileEditorModel', () => {
const now = Date.now();
await model.save();
assert.equal(eventCounter, 2);
assert.strictEqual(eventCounter, 2);
assert.ok(Date.now() - now >= 10);
model.dispose();
......@@ -700,7 +700,7 @@ suite('Files - TextFileEditorModel', () => {
const p4 = model.save();
await Promise.all([p1, p2, p3, p4]);
assert.equal(participations.length, 1);
assert.strictEqual(participations.length, 1);
model.dispose();
participant.dispose();
......@@ -740,7 +740,7 @@ suite('Files - TextFileEditorModel', () => {
const newSavePromise = model.save();
// assert that this is the same promise as the outer one
assert.equal(savePromise, newSavePromise);
assert.strictEqual(savePromise, newSavePromise);
}
});
......
......@@ -60,11 +60,11 @@ suite('Workbench editor model', () => {
const model = await m.load();
assert(model === m);
assert.equal(model.isDisposed(), false);
assert.strictEqual(model.isDisposed(), false);
assert.strictEqual(m.isResolved(), true);
m.dispose();
assert.equal(counter, 1);
assert.equal(model.isDisposed(), true);
assert.strictEqual(counter, 1);
assert.strictEqual(model.isDisposed(), true);
});
test('BaseTextEditorModel', async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册