本文整理汇总了TypeScript中vs/editor/node/model/modelBuilder.ModelBuilder.acceptChunk方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ModelBuilder.acceptChunk方法的具体用法?TypeScript ModelBuilder.acceptChunk怎么用?TypeScript ModelBuilder.acceptChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/node/model/modelBuilder.ModelBuilder
的用法示例。
在下文中一共展示了ModelBuilder.acceptChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: testModelBuilder
export function testModelBuilder(chunks: string[], opts: ITextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS): string {
let expectedRawText = TextModel.toRawText(chunks.join(''), opts);
let expectedHash = computeHash(expectedRawText);
let builder = new ModelBuilder();
for (let i = 0, len = chunks.length; i < len; i++) {
builder.acceptChunk(chunks[i]);
}
let actual = builder.finish(opts);
assert.deepEqual({
rawText: expectedRawText,
hash: expectedHash
}, actual);
return expectedHash;
}
示例2: testModelBuilder
export function testModelBuilder(chunks: string[], opts: ITextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS): string {
let expectedTextSource = TextModel.toTextSource(chunks.join(''));
let expectedHash = computeHash(expectedTextSource);
let builder = new ModelBuilder();
for (let i = 0, len = chunks.length; i < len; i++) {
builder.acceptChunk(chunks[i]);
}
let actual = builder.finish();
let actualTextSource = actual.value;
let actualHash = actual.hash;
assert.equal(actualHash, expectedHash);
assert.deepEqual(actualTextSource, expectedTextSource);
return expectedHash;
}