diff --git a/src/vs/base/common/strings.ts b/src/vs/base/common/strings.ts index 1245bef3ca4c8fc5003f7eef234af19370b348dc..536eabdbbeada9a9a13d5164e41a8f28412cf801 100644 --- a/src/vs/base/common/strings.ts +++ b/src/vs/base/common/strings.ts @@ -618,20 +618,6 @@ export function isFullWidthCharacter(charCode: number): boolean { ); } -/** - * Returns an array in which every entry is the offset of a - * line. There is always one entry which is zero. - */ -export function computeLineStarts(text: string): number[] { - let regexp = /\r\n|\r|\n/g, - ret: number[] = [0], - match: RegExpExecArray; - while ((match = regexp.exec(text))) { - ret.push(regexp.lastIndex); - } - return ret; -} - /** * Given a string and a max length returns a shorted version. Shorting * happens at favorable positions - such as whitespace or punctuation characters. @@ -683,25 +669,6 @@ export function stripUTF8BOM(str: string): string { return startsWithUTF8BOM(str) ? str.substr(1) : str; } -/** - * Appends two strings. If the appended result is longer than maxLength, - * trims the start of the result and replaces it with '...'. - */ -export function appendWithLimit(first: string, second: string, maxLength: number): string { - const newLength = first.length + second.length; - if (newLength > maxLength) { - first = '...' + first.substr(newLength - maxLength); - } - if (second.length > maxLength) { - first += second.substr(second.length - maxLength); - } else { - first += second; - } - - return first; -} - - export function safeBtoa(str: string): string { return btoa(encodeURIComponent(str)); // we use encodeURIComponent because btoa fails for non Latin 1 values } diff --git a/src/vs/base/common/uuid.ts b/src/vs/base/common/uuid.ts index 89c97bbb432d61739bcc754a7109a05440a6875f..704882a545c68554cff3eca7b2d1c2f0145a4536 100644 --- a/src/vs/base/common/uuid.ts +++ b/src/vs/base/common/uuid.ts @@ -13,8 +13,6 @@ export interface UUID { * @returns the canonical representation in sets of hexadecimal numbers separated by dashes. */ asHex(): string; - - equals(other: UUID): boolean; } class ValueUUID implements UUID { @@ -26,10 +24,6 @@ class ValueUUID implements UUID { public asHex(): string { return this._value; } - - public equals(other: UUID): boolean { - return this.asHex() === other.asHex(); - } } class V4UUID extends ValueUUID { diff --git a/src/vs/base/test/common/strings.test.ts b/src/vs/base/test/common/strings.test.ts index 9212cce234fb38c470023604178cc4c070ae6e3f..fb413969ce8f9a69212ec7306d7bcc576b1e4f6b 100644 --- a/src/vs/base/test/common/strings.test.ts +++ b/src/vs/base/test/common/strings.test.ts @@ -103,29 +103,6 @@ suite('Strings', () => { assert.equal(strings.overlap('full', 'full'), 4); assert.equal(strings.overlap('full', 'fulloverlap'), 4); }); - - test('computeLineStarts', function () { - function assertLineStart(text: string, ...offsets: number[]): void { - const actual = strings.computeLineStarts(text); - assert.equal(actual.length, offsets.length); - if (actual.length !== offsets.length) { - return; - } - while (offsets.length > 0) { - assert.equal(actual.pop(), offsets.pop()); - } - } - - assertLineStart('', 0); - assertLineStart('farboo', 0); - assertLineStart('far\nboo', 0, 4); - assertLineStart('far\rboo', 0, 4); - assertLineStart('far\r\nboo', 0, 5); - assertLineStart('far\n\rboo', 0, 4, 5); - assertLineStart('far\n \rboo', 0, 4, 6); - assertLineStart('far\nboo\nfar', 0, 4, 8); - }); - test('lcut', () => { assert.strictEqual(strings.lcut('foo bar', 0), ''); assert.strictEqual(strings.lcut('foo bar', 1), 'bar'); @@ -218,13 +195,6 @@ suite('Strings', () => { assert.strictEqual(' '.trim(), ''); }); - test('appendWithLimit', function () { - assert.strictEqual(strings.appendWithLimit('ab', 'cd', 100), 'abcd'); - assert.strictEqual(strings.appendWithLimit('ab', 'cd', 2), '...cd'); - assert.strictEqual(strings.appendWithLimit('ab', 'cdefgh', 4), '...efgh'); - assert.strictEqual(strings.appendWithLimit('abcdef', 'ghijk', 7), '...efghijk'); - }); - test('repeat', () => { assert.strictEqual(strings.repeat(' ', 4), ' '); assert.strictEqual(strings.repeat(' ', 1), ' '); diff --git a/src/vs/base/test/common/uuid.test.ts b/src/vs/base/test/common/uuid.test.ts index c9c371742760b671575bd87869aa5e5f4a98bfcc..eaa4ed3dbf0ecfb73951ada6a56da988117519ca 100644 --- a/src/vs/base/test/common/uuid.test.ts +++ b/src/vs/base/test/common/uuid.test.ts @@ -12,14 +12,13 @@ suite('UUID', () => { var asHex = uuid.v4().asHex(); assert.equal(asHex.length, 36); assert.equal(asHex[14], '4'); - assert(asHex[19] === '8' || asHex[19] === '9' || asHex[19] === 'a' || asHex[19] === 'b'); + assert.ok(asHex[19] === '8' || asHex[19] === '9' || asHex[19] === 'a' || asHex[19] === 'b'); }); test('parse', () => { var id = uuid.v4(); var asHext = id.asHex(); var id2 = uuid.parse(asHext); - assert(id.equals(id2)); - assert(id2.equals(id)); + assert.equal(id.asHex(), id2.asHex()); }); -}); \ No newline at end of file +});