本文整理汇总了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));
});
示例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);
});
示例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 }));
});
示例4:
assert.throws(() => p1.with(0, -9));
示例5:
assert.throws(() => p1.with({ character: -1 }));