Add broken test for issue #27854
This commit is contained in:
parent
e58371e03a
commit
b1fbff8b98
|
@ -40,6 +40,17 @@ namespace ts {
|
|||
return (file: SourceFile) => file;
|
||||
}
|
||||
|
||||
function replaceIdentifiersNamedOldNameWithNewName2(context: TransformationContext) {
|
||||
const visitor: Visitor = (node) => {
|
||||
if (isIdentifier(node) && node.text === "oldName") {
|
||||
return createIdentifier("newName");
|
||||
}
|
||||
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
return (node: SourceFile) => visitNode(node, visitor);
|
||||
}
|
||||
|
||||
function transformSourceFile(sourceText: string, transformers: TransformerFactory<SourceFile>[]) {
|
||||
const transformed = transform(createSourceFile("source.ts", sourceText, ScriptTarget.ES2015), transformers);
|
||||
const printer = createPrinter({ newLine: NewLineKind.CarriageReturnLineFeed }, {
|
||||
|
@ -81,6 +92,18 @@ namespace ts {
|
|||
}).outputText;
|
||||
});
|
||||
|
||||
testBaseline("issue27854", () => {
|
||||
return transpileModule(`oldName<{ a: string; }>\` ... \`;`, {
|
||||
transformers: {
|
||||
before: [replaceIdentifiersNamedOldNameWithNewName2]
|
||||
},
|
||||
compilerOptions: {
|
||||
newLine: NewLineKind.CarriageReturnLineFeed,
|
||||
target: ts.ScriptTarget.Latest
|
||||
}
|
||||
}).outputText;
|
||||
});
|
||||
|
||||
testBaseline("rewrittenNamespace", () => {
|
||||
return transpileModule(`namespace Reflect { const x = 1; }`, {
|
||||
transformers: {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
newName<{
|
||||
a: string;
|
||||
}> ` ... `;
|
Loading…
Reference in a new issue