Skip to content

Commit

Permalink
Find model tests on Piece Tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Mar 13, 2018
1 parent d0daae3 commit 7caa70c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/vs/editor/contrib/find/test/findModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import { FindReplaceState } from 'vs/editor/contrib/find/findState';
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
import { CoreNavigationCommands } from 'vs/editor/browser/controller/coreCommands';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { TextModel } from 'vs/editor/common/model/textModel';
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';

suite('FindModel', () => {

function findTest(testName: string, callback: (editor: ICodeEditor, cursor: Cursor) => void): void {
test(testName, () => {
withTestCodeEditor([
const textArr = [
'// my cool header',
'#include "cool.h"',
'#include <iostream>',
Expand All @@ -32,7 +34,19 @@ suite('FindModel', () => {
'}',
'// blablablaciao',
''
], {}, callback);
];
withTestCodeEditor(textArr, {}, callback);

const text = textArr.join('\n');
const ptBuilder = new PieceTreeTextBufferBuilder();
ptBuilder.acceptChunk(text.substr(0, 94));
ptBuilder.acceptChunk(text.substr(94, 101));
ptBuilder.acceptChunk(text.substr(195, 59));
const factory = ptBuilder.finish();
withTestCodeEditor([],
{
model: new TextModel(factory, TextModel.DEFAULT_CREATION_OPTIONS, null, null)
}, callback);
});
}

Expand Down

0 comments on commit 7caa70c

Please sign in to comment.