當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript extHostTypes.Position類代碼示例

本文整理匯總了TypeScript中vs/workbench/api/node/extHostTypes.Position的典型用法代碼示例。如果您正苦於以下問題:TypeScript Position類的具體用法?TypeScript Position怎麽用?TypeScript Position使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Position類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

	test('Position, isBefore(OrEqual)?', function() {
		let p1 = new types.Position(1, 3);
		let p2 = new types.Position(1, 2);
		let p3 = new types.Position(0, 4);

		assert.ok(p1.isBeforeOrEqual(p1));
		assert.ok(!p1.isBefore(p1));
		assert.ok(p2.isBefore(p1));
		assert.ok(p3.isBefore(p2));
	});
開發者ID:578723746,項目名稱:vscode,代碼行數:10,代碼來源:extHostTypes.test.ts

示例2: test

	test('Position, compareTo', function() {
		let p1 = new types.Position(1, 3);
		let p2 = new types.Position(1, 2);
		let p3 = new types.Position(0, 4);

		assert.equal(p1.compareTo(p1), 0);
		assert.equal(p2.compareTo(p1), -1);
		assert.equal(p1.compareTo(p2), 1);
		assert.equal(p2.compareTo(p3), 1);
		assert.equal(p1.compareTo(p3), 1);
	});
開發者ID:13572293130,項目名稱:vscode,代碼行數:11,代碼來源:extHostTypes.test.ts

示例3: test

	test('Position, with', function () {
		let p1 = new types.Position(1, 3);

		assert.ok(p1.with() === p1);
		assert.ok(p1.with(1) === p1);
		assert.ok(p1.with(undefined, 3) === p1);
		assert.ok(p1.with(1, 3) === p1);
		assert.ok(p1.with(undefined) === p1);
		assert.ok(p1.with({ line: 1 }) === p1);
		assert.ok(p1.with({ character: 3 }) === p1);
		assert.ok(p1.with({ line: 1, character: 3 }) === p1);

		let p2 = p1.with({ line: 0, character: 11 });
		assert.equal(p2.line, 0);
		assert.equal(p2.character, 11);

		assert.throws(() => p1.with(null));
		assert.throws(() => p1.with(-9));
		assert.throws(() => p1.with(0, -9));
		assert.throws(() => p1.with({ line: -1 }));
		assert.throws(() => p1.with({ character: -1 }));
	});
開發者ID:jumpinjackie,項目名稱:sqlopsstudio,代碼行數:22,代碼來源:extHostTypes.test.ts

示例4:

		assert.throws(() => p1.with(0, -9));
開發者ID:13572293130,項目名稱:vscode,代碼行數:1,代碼來源:extHostTypes.test.ts

示例5:

		assert.throws(() => p1.with({ character: -1 }));
開發者ID:jumpinjackie,項目名稱:sqlopsstudio,代碼行數:1,代碼來源:extHostTypes.test.ts


注:本文中的vs/workbench/api/node/extHostTypes.Position類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。