MCPcopy
hub / github.com/VSCodeVim/Vim / assertDocState

Function assertDocState

test/testSimplifier.ts:215–234  ·  view source on GitHub ↗
(vimState: VimState, docState: DocState)

Source from the content-addressed store, hash-verified

213}
214
215function assertDocState(vimState: VimState, docState: DocState): void {
216 assertEqualLines(docState.lines);
217
218 const simplify = (position: Position) => ({ line: position.line, character: position.character });
219 const compare = (
220 a: { line: number; character: number },
221 b: { line: number; character: number },
222 ) => {
223 if (a.line !== b.line) {
224 return a.line - b.line;
225 }
226 return a.character - b.character;
227 };
228 // TODO: Assert selections match vimState.cursors
229 assert.deepEqual(
230 vimState.cursors.map((cursor) => simplify(cursor.stop)).sort(compare),
231 docState.cursors.map(simplify).sort(compare),
232 'Cursors are wrong.',
233 );
234}
235
236export async function testIt(testObj: ITestObject): Promise<ModeHandler> {
237 const editor = vscode.window.activeTextEditor;

Callers 1

testItFunction · 0.85

Calls 2

assertEqualLinesFunction · 0.90
simplifyFunction · 0.85

Tested by

no test coverage detected