Remove some duplicate code in convertToAsyncFunction unit tests (#26527)
This commit is contained in:
parent
926bdee888
commit
435a12e476
2 changed files with 2 additions and 34 deletions
|
@ -319,38 +319,6 @@ interface String { charAt: any; }
|
||||||
interface Array<T> {}`
|
interface Array<T> {}`
|
||||||
};
|
};
|
||||||
|
|
||||||
const newLineCharacter = "\n";
|
|
||||||
const formatOptions: FormatCodeSettings = {
|
|
||||||
indentSize: 4,
|
|
||||||
tabSize: 4,
|
|
||||||
newLineCharacter,
|
|
||||||
convertTabsToSpaces: true,
|
|
||||||
indentStyle: IndentStyle.Smart,
|
|
||||||
insertSpaceAfterConstructor: false,
|
|
||||||
insertSpaceAfterCommaDelimiter: true,
|
|
||||||
insertSpaceAfterSemicolonInForStatements: true,
|
|
||||||
insertSpaceBeforeAndAfterBinaryOperators: true,
|
|
||||||
insertSpaceAfterKeywordsInControlFlowStatements: true,
|
|
||||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
|
||||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
|
||||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
|
||||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
|
|
||||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
|
|
||||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
|
|
||||||
insertSpaceBeforeFunctionParenthesis: false,
|
|
||||||
placeOpenBraceOnNewLineForFunctions: false,
|
|
||||||
placeOpenBraceOnNewLineForControlBlocks: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
const notImplementedHost: LanguageServiceHost = {
|
|
||||||
getCompilationSettings: notImplemented,
|
|
||||||
getScriptFileNames: notImplemented,
|
|
||||||
getScriptVersion: notImplemented,
|
|
||||||
getScriptSnapshot: notImplemented,
|
|
||||||
getDefaultLibFileName: notImplemented,
|
|
||||||
getCurrentDirectory: notImplemented,
|
|
||||||
};
|
|
||||||
|
|
||||||
function testConvertToAsyncFunction(caption: string, text: string, baselineFolder: string, description: DiagnosticMessage, includeLib?: boolean) {
|
function testConvertToAsyncFunction(caption: string, text: string, baselineFolder: string, description: DiagnosticMessage, includeLib?: boolean) {
|
||||||
const t = getTest(text);
|
const t = getTest(text);
|
||||||
const selectionRange = t.ranges.get("selection")!;
|
const selectionRange = t.ranges.get("selection")!;
|
||||||
|
@ -389,7 +357,7 @@ interface Array<T> {}`
|
||||||
cancellationToken: { throwIfCancellationRequested: noop, isCancellationRequested: returnFalse },
|
cancellationToken: { throwIfCancellationRequested: noop, isCancellationRequested: returnFalse },
|
||||||
preferences: emptyOptions,
|
preferences: emptyOptions,
|
||||||
host: notImplementedHost,
|
host: notImplementedHost,
|
||||||
formatContext: formatting.getFormatContext(formatOptions)
|
formatContext: formatting.getFormatContext(testFormatOptions)
|
||||||
};
|
};
|
||||||
|
|
||||||
const diagnostics = languageService.getSuggestionDiagnostics(f.path);
|
const diagnostics = languageService.getSuggestionDiagnostics(f.path);
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace ts {
|
||||||
placeOpenBraceOnNewLineForControlBlocks: false,
|
placeOpenBraceOnNewLineForControlBlocks: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const notImplementedHost: LanguageServiceHost = {
|
export const notImplementedHost: LanguageServiceHost = {
|
||||||
getCompilationSettings: notImplemented,
|
getCompilationSettings: notImplemented,
|
||||||
getScriptFileNames: notImplemented,
|
getScriptFileNames: notImplemented,
|
||||||
getScriptVersion: notImplemented,
|
getScriptVersion: notImplemented,
|
||||||
|
|
Loading…
Reference in a new issue