mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-22 06:56:11 +03:00
remove test taht fails on typescript 4(tests an unused transformation, dead code removal)
This commit is contained in:
parent
94cc4a348f
commit
4242d34708
@ -1,40 +0,0 @@
|
||||
import ts from 'typescript';
|
||||
import { createRemoveUnusedLocalsTransform } from '../src/transforms/removeUnusedLocals';
|
||||
|
||||
test('it can process nested calls of A2 with non identifiers as the first arg ', () => {
|
||||
const initialCode = `
|
||||
(function (){
|
||||
function f () {return 2;}
|
||||
const f2 = () => 1 + f();
|
||||
const test = 1 + 2, bla="bla";
|
||||
console.log(test);
|
||||
})()
|
||||
`;
|
||||
|
||||
const expectedOutputCode = `
|
||||
(function (){
|
||||
const test = 1 + 2;
|
||||
console.log(test);
|
||||
})()
|
||||
`;
|
||||
|
||||
const source = ts.createSourceFile(
|
||||
'elm.js',
|
||||
initialCode,
|
||||
ts.ScriptTarget.ES2018
|
||||
);
|
||||
|
||||
const printer = ts.createPrinter();
|
||||
|
||||
const [output] = ts.transform(source, [
|
||||
createRemoveUnusedLocalsTransform(),
|
||||
]).transformed;
|
||||
|
||||
const expectedOutput = printer.printFile(
|
||||
ts.createSourceFile('elm.js', expectedOutputCode, ts.ScriptTarget.ES2018)
|
||||
);
|
||||
|
||||
const printedOutput = printer.printFile(output);
|
||||
|
||||
expect(printedOutput).toBe(expectedOutput);
|
||||
});
|
Loading…
Reference in New Issue
Block a user