Add test harnesses

This commit is contained in:
Arthur Ozga 2015-07-21 14:15:39 -07:00
parent 6d174a0f18
commit 38005e7174
3 changed files with 22 additions and 5 deletions

View File

@ -1942,6 +1942,18 @@ module FourSlash {
}
}
public verfiyDocCommentScaffolding(position: number, expected: ts.TextInsertion) {
let actual = this.languageService.getDocCommentScaffoldingAtPosition(this.activeFile.fileName, position);
if (actual.newText !== expected.newText) {
this.raiseError('verfiyDocCommentScaffolding failed - expected insertion:\n' + expected.newText + 'actual insertion:\n' + actual.newText);
}
if (actual.cursorOffset !== expected.cursorOffset) {
this.raiseError('verfiyDocCommentScaffolding failed - expected cursorOffset: ' + expected.cursorOffset + ',\tactual cursorOffset:' + actual.cursorOffset);
}
}
public verifyMatchingBracePosition(bracePosition: number, expectedMatchPosition: number) {
this.taoInvalidReason = 'verifyMatchingBracePosition NYI';

View File

@ -541,7 +541,7 @@ namespace ts.server {
throw new Error("Not Implemented Yet.");
}
getDocCommentScaffoldingAtPosition(fileName: string, position: number): string {
getDocCommentScaffoldingAtPosition(fileName: string, position: number): TextInsertion {
throw new Error("Not Implemented Yet.");
}

View File

@ -269,10 +269,10 @@ module FourSlashInterface {
}
/**
Compiles the current file and evaluates 'expr' in a context containing
the emitted output, then compares (using ===) the result of that expression
to 'value'. Do not use this function with external modules as it is not supported.
*/
* Compiles the current file and evaluates 'expr' in a context containing
* the emitted output, then compares (using ===) the result of that expression
* to 'value'. Do not use this function with external modules as it is not supported.
*/
public eval(expr: string, value: any) {
FourSlash.currentTestState.verifyEval(expr, value);
}
@ -365,6 +365,11 @@ module FourSlashInterface {
FourSlash.currentTestState.setVerifyDocComments(val);
}
// Will fix in fourslash-referencing
public DocCommentScaffolding(position: number, expected: ts.TextInsertion) {
FourSlash.currentTestState.verifyDocCommentScaffolding(position, expected);
}
public getScriptLexicalStructureListCount(count: number) {
FourSlash.currentTestState.verifyGetScriptLexicalStructureListCount(count);
}