From da367bd8fc1fe06f504fc61d0544b88b9cae84ad Mon Sep 17 00:00:00 2001 From: coderiaser Date: Sun, 16 Jun 2024 13:22:38 +0300 Subject: [PATCH] feature: @putout/minify: add support of merge-assignment-expressions --- test/fixture/class-fix.js | 2 +- test/fixture/merge-assignment-expressions-fix.js | 1 + test/fixture/merge-assignment-expressions.js | 3 +++ test/minify.js | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/fixture/merge-assignment-expressions-fix.js create mode 100644 test/fixture/merge-assignment-expressions.js diff --git a/test/fixture/class-fix.js b/test/fixture/class-fix.js index fc2bf30..8f30284 100644 --- a/test/fixture/class-fix.js +++ b/test/fixture/class-fix.js @@ -1 +1 @@ -var a='foo',b=123.4;class C{f(){}constructor(){this.d=a;this.e=b}}var g=new C();globalThis.h=g;globalThis.i=g; \ No newline at end of file +var a='foo',b=123.4;class C{f(){}constructor(){this.d=a;this.e=b}}var g=new C();globalThis.h=globalThis.i=g; \ No newline at end of file diff --git a/test/fixture/merge-assignment-expressions-fix.js b/test/fixture/merge-assignment-expressions-fix.js new file mode 100644 index 0000000..75bbab5 --- /dev/null +++ b/test/fixture/merge-assignment-expressions-fix.js @@ -0,0 +1 @@ +a=b=c=5; \ No newline at end of file diff --git a/test/fixture/merge-assignment-expressions.js b/test/fixture/merge-assignment-expressions.js new file mode 100644 index 0000000..8b10203 --- /dev/null +++ b/test/fixture/merge-assignment-expressions.js @@ -0,0 +1,3 @@ +a = 5; +b = 5; +c = 5; diff --git a/test/minify.js b/test/minify.js index c1b6853..3bde1b8 100644 --- a/test/minify.js +++ b/test/minify.js @@ -110,6 +110,11 @@ test('@putout/minify: merge-duplicate-functions', (t) => { t.end(); }); +test('@putout/minify: merge-assignment-expressions', (t) => { + t.minify('merge-assignment-expressions'); + t.end(); +}); + test('@putout/minify: merge-duplicate-imports', (t) => { t.minify('merge-duplicate-imports', { run: false,