Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Unified Diff: node_modules/vulcanize/node_modules/uglify-js/test/compress/negate-iife.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/uglify-js/test/compress/negate-iife.js
diff --git a/node_modules/vulcanize/node_modules/uglify-js/test/compress/negate-iife.js b/node_modules/vulcanize/node_modules/uglify-js/test/compress/negate-iife.js
new file mode 100644
index 0000000000000000000000000000000000000000..89c3f0646a316f47a2a8fe25b9e3a721e78f8994
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/uglify-js/test/compress/negate-iife.js
@@ -0,0 +1,76 @@
+negate_iife_1: {
+ options = {
+ negate_iife: true
+ };
+ input: {
+ (function(){ stuff() })();
+ }
+ expect: {
+ !function(){ stuff() }();
+ }
+}
+
+negate_iife_2: {
+ options = {
+ negate_iife: true
+ };
+ input: {
+ (function(){ return {} })().x = 10; // should not transform this one
+ }
+ expect: {
+ (function(){ return {} })().x = 10;
+ }
+}
+
+negate_iife_3: {
+ options = {
+ negate_iife: true,
+ };
+ input: {
+ (function(){ return true })() ? console.log(true) : console.log(false);
+ }
+ expect: {
+ !function(){ return true }() ? console.log(false) : console.log(true);
+ }
+}
+
+negate_iife_3: {
+ options = {
+ negate_iife: true,
+ sequences: true
+ };
+ input: {
+ (function(){ return true })() ? console.log(true) : console.log(false);
+ (function(){
+ console.log("something");
+ })();
+ }
+ expect: {
+ !function(){ return true }() ? console.log(false) : console.log(true), function(){
+ console.log("something");
+ }();
+ }
+}
+
+negate_iife_4: {
+ options = {
+ negate_iife: true,
+ sequences: true,
+ conditionals: true,
+ };
+ input: {
+ if ((function(){ return true })()) {
+ foo(true);
+ } else {
+ bar(false);
+ }
+ (function(){
+ console.log("something");
+ })();
+ }
+ expect: {
+ !function(){ return true }() ? bar(false) : foo(true), function(){
+ console.log("something");
+ }();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698