mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-15 22:15:05 -05:00
Add regression test
This commit is contained in:
@@ -2238,6 +2238,20 @@ Actual: ${stringify(fullActual)}`);
|
||||
});
|
||||
}
|
||||
|
||||
public verifyOutliningHintSpans(spans: Range[]) {
|
||||
const actual = this.languageService.getOutliningSpans(this.activeFile.fileName);
|
||||
|
||||
if (actual.length !== spans.length) {
|
||||
this.raiseError(`verifyOutliningHintSpans failed - expected total spans to be ${spans.length}, but was ${actual.length}`);
|
||||
}
|
||||
|
||||
ts.zipWith(spans, actual, (expectedSpan, actualSpan, i) => {
|
||||
if (expectedSpan.pos !== actualSpan.hintSpan.start || expectedSpan.end !== ts.textSpanEnd(actualSpan.hintSpan)) {
|
||||
return this.raiseError(`verifyOutliningSpans failed - span ${(i + 1)} expected: (${expectedSpan.pos},${expectedSpan.end}), actual: (${actualSpan.hintSpan.start},${ts.textSpanEnd(actualSpan.hintSpan)})`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public verifyTodoComments(descriptors: string[], spans: Range[]) {
|
||||
const actual = this.languageService.getTodoComments(this.activeFile.fileName,
|
||||
descriptors.map(d => { return { text: d, priority: 0 }; }));
|
||||
@@ -4005,6 +4019,10 @@ namespace FourSlashInterface {
|
||||
this.state.verifyOutliningSpans(spans, kind);
|
||||
}
|
||||
|
||||
public outliningHintSpansInCurrentFile(spans: FourSlash.Range[]) {
|
||||
this.state.verifyOutliningHintSpans(spans);
|
||||
}
|
||||
|
||||
public todoCommentsInCurrentFile(descriptors: string[]) {
|
||||
this.state.verifyTodoComments(descriptors, this.state.getRanges());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user