[Pkg-javascript-commits] [uglifyjs] 32/228: Add .gitattributes to checkout lf eol style
Jonas Smedegaard
dr at jones.dk
Sat Apr 15 14:25:14 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository uglifyjs.
commit c06a50f338c1b473f38577d720ccf9b4ff22dc4f
Author: Anthony Van de Gejuchte <anthonyvdgent at gmail.com>
Date: Sat Feb 18 19:33:05 2017 +0800
Add .gitattributes to checkout lf eol style
closes #1487
---
.gitattributes | 1 +
test/compress/dead-code.js | 412 +++++++++++++++++++++---------------------
test/compress/drop-console.js | 48 ++---
3 files changed, 231 insertions(+), 230 deletions(-)
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..6edcf86
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.js text eol=lf
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js
index fa4b37d..c83f204 100644
--- a/test/compress/dead-code.js
+++ b/test/compress/dead-code.js
@@ -1,206 +1,206 @@
-dead_code_1: {
- options = {
- dead_code: true
- };
- input: {
- function f() {
- a();
- b();
- x = 10;
- return;
- if (x) {
- y();
- }
- }
- }
- expect: {
- function f() {
- a();
- b();
- x = 10;
- return;
- }
- }
-}
-
-dead_code_2_should_warn: {
- options = {
- dead_code: true
- };
- input: {
- function f() {
- g();
- x = 10;
- throw "foo";
- // completely discarding the `if` would introduce some
- // bugs. UglifyJS v1 doesn't deal with this issue; in v2
- // we copy any declarations to the upper scope.
- if (x) {
- y();
- var x;
- function g(){};
- // but nested declarations should not be kept.
- (function(){
- var q;
- function y(){};
- })();
- }
- }
- }
- expect: {
- function f() {
- g();
- x = 10;
- throw "foo";
- var x;
- function g(){};
- }
- }
-}
-
-dead_code_constant_boolean_should_warn_more: {
- options = {
- dead_code : true,
- loops : true,
- booleans : true,
- conditionals : true,
- evaluate : true
- };
- input: {
- while (!((foo && bar) || (x + "0"))) {
- console.log("unreachable");
- var foo;
- function bar() {}
- }
- for (var x = 10, y; x && (y || x) && (!typeof x); ++x) {
- asdf();
- foo();
- var moo;
- }
- }
- expect: {
- var foo;
- function bar() {}
- // nothing for the while
- // as for the for, it should keep:
- var x = 10, y;
- var moo;
- }
-}
-
-dead_code_const_declaration: {
- options = {
- dead_code : true,
- loops : true,
- booleans : true,
- conditionals : true,
- evaluate : true
- };
- input: {
- var unused;
- const CONST_FOO = false;
- if (CONST_FOO) {
- console.log("unreachable");
- var moo;
- function bar() {}
- }
- }
- expect: {
- var unused;
- const CONST_FOO = !1;
- var moo;
- function bar() {}
- }
-}
-
-dead_code_const_annotation: {
- options = {
- dead_code : true,
- loops : true,
- booleans : true,
- conditionals : true,
- evaluate : true
- };
- input: {
- var unused;
- /** @const */ var CONST_FOO_ANN = false;
- if (CONST_FOO_ANN) {
- console.log("unreachable");
- var moo;
- function bar() {}
- }
- }
- expect: {
- var unused;
- var CONST_FOO_ANN = !1;
- var moo;
- function bar() {}
- }
-}
-
-dead_code_const_annotation_regex: {
- options = {
- dead_code : true,
- loops : true,
- booleans : true,
- conditionals : true,
- evaluate : true
- };
- input: {
- var unused;
- // @constraint this shouldn't be a constant
- var CONST_FOO_ANN = false;
- if (CONST_FOO_ANN) {
- console.log("reachable");
- }
- }
- expect: {
- var unused;
- var CONST_FOO_ANN = !1;
- CONST_FOO_ANN && console.log('reachable');
- }
-}
-
-dead_code_const_annotation_complex_scope: {
- options = {
- dead_code : true,
- loops : true,
- booleans : true,
- conditionals : true,
- evaluate : true
- };
- input: {
- var unused_var;
- /** @const */ var test = 'test';
- // @const
- var CONST_FOO_ANN = false;
- var unused_var_2;
- if (CONST_FOO_ANN) {
- console.log("unreachable");
- var moo;
- function bar() {}
- }
- if (test === 'test') {
- var beef = 'good';
- /** @const */ var meat = 'beef';
- var pork = 'bad';
- if (meat === 'pork') {
- console.log('also unreachable');
- } else if (pork === 'good') {
- console.log('reached, not const');
- }
- }
- }
- expect: {
- var unused_var;
- var test = 'test';
- var CONST_FOO_ANN = !1;
- var unused_var_2;
- var moo;
- function bar() {}
- var beef = 'good';
- var meat = 'beef';
- var pork = 'bad';
- 'good' === pork && console.log('reached, not const');
- }
-}
+dead_code_1: {
+ options = {
+ dead_code: true
+ };
+ input: {
+ function f() {
+ a();
+ b();
+ x = 10;
+ return;
+ if (x) {
+ y();
+ }
+ }
+ }
+ expect: {
+ function f() {
+ a();
+ b();
+ x = 10;
+ return;
+ }
+ }
+}
+
+dead_code_2_should_warn: {
+ options = {
+ dead_code: true
+ };
+ input: {
+ function f() {
+ g();
+ x = 10;
+ throw "foo";
+ // completely discarding the `if` would introduce some
+ // bugs. UglifyJS v1 doesn't deal with this issue; in v2
+ // we copy any declarations to the upper scope.
+ if (x) {
+ y();
+ var x;
+ function g(){};
+ // but nested declarations should not be kept.
+ (function(){
+ var q;
+ function y(){};
+ })();
+ }
+ }
+ }
+ expect: {
+ function f() {
+ g();
+ x = 10;
+ throw "foo";
+ var x;
+ function g(){};
+ }
+ }
+}
+
+dead_code_constant_boolean_should_warn_more: {
+ options = {
+ dead_code : true,
+ loops : true,
+ booleans : true,
+ conditionals : true,
+ evaluate : true
+ };
+ input: {
+ while (!((foo && bar) || (x + "0"))) {
+ console.log("unreachable");
+ var foo;
+ function bar() {}
+ }
+ for (var x = 10, y; x && (y || x) && (!typeof x); ++x) {
+ asdf();
+ foo();
+ var moo;
+ }
+ }
+ expect: {
+ var foo;
+ function bar() {}
+ // nothing for the while
+ // as for the for, it should keep:
+ var x = 10, y;
+ var moo;
+ }
+}
+
+dead_code_const_declaration: {
+ options = {
+ dead_code : true,
+ loops : true,
+ booleans : true,
+ conditionals : true,
+ evaluate : true
+ };
+ input: {
+ var unused;
+ const CONST_FOO = false;
+ if (CONST_FOO) {
+ console.log("unreachable");
+ var moo;
+ function bar() {}
+ }
+ }
+ expect: {
+ var unused;
+ const CONST_FOO = !1;
+ var moo;
+ function bar() {}
+ }
+}
+
+dead_code_const_annotation: {
+ options = {
+ dead_code : true,
+ loops : true,
+ booleans : true,
+ conditionals : true,
+ evaluate : true
+ };
+ input: {
+ var unused;
+ /** @const */ var CONST_FOO_ANN = false;
+ if (CONST_FOO_ANN) {
+ console.log("unreachable");
+ var moo;
+ function bar() {}
+ }
+ }
+ expect: {
+ var unused;
+ var CONST_FOO_ANN = !1;
+ var moo;
+ function bar() {}
+ }
+}
+
+dead_code_const_annotation_regex: {
+ options = {
+ dead_code : true,
+ loops : true,
+ booleans : true,
+ conditionals : true,
+ evaluate : true
+ };
+ input: {
+ var unused;
+ // @constraint this shouldn't be a constant
+ var CONST_FOO_ANN = false;
+ if (CONST_FOO_ANN) {
+ console.log("reachable");
+ }
+ }
+ expect: {
+ var unused;
+ var CONST_FOO_ANN = !1;
+ CONST_FOO_ANN && console.log('reachable');
+ }
+}
+
+dead_code_const_annotation_complex_scope: {
+ options = {
+ dead_code : true,
+ loops : true,
+ booleans : true,
+ conditionals : true,
+ evaluate : true
+ };
+ input: {
+ var unused_var;
+ /** @const */ var test = 'test';
+ // @const
+ var CONST_FOO_ANN = false;
+ var unused_var_2;
+ if (CONST_FOO_ANN) {
+ console.log("unreachable");
+ var moo;
+ function bar() {}
+ }
+ if (test === 'test') {
+ var beef = 'good';
+ /** @const */ var meat = 'beef';
+ var pork = 'bad';
+ if (meat === 'pork') {
+ console.log('also unreachable');
+ } else if (pork === 'good') {
+ console.log('reached, not const');
+ }
+ }
+ }
+ expect: {
+ var unused_var;
+ var test = 'test';
+ var CONST_FOO_ANN = !1;
+ var unused_var_2;
+ var moo;
+ function bar() {}
+ var beef = 'good';
+ var meat = 'beef';
+ var pork = 'bad';
+ 'good' === pork && console.log('reached, not const');
+ }
+}
diff --git a/test/compress/drop-console.js b/test/compress/drop-console.js
index 2333722..7df6d9d 100644
--- a/test/compress/drop-console.js
+++ b/test/compress/drop-console.js
@@ -1,24 +1,24 @@
-drop_console_1: {
- options = {};
- input: {
- console.log('foo');
- console.log.apply(console, arguments);
- }
- expect: {
- console.log('foo');
- console.log.apply(console, arguments);
- }
-}
-
-drop_console_2: {
- options = { drop_console: true };
- input: {
- console.log('foo');
- console.log.apply(console, arguments);
- }
- expect: {
- // with regular compression these will be stripped out as well
- void 0;
- void 0;
- }
-}
+drop_console_1: {
+ options = {};
+ input: {
+ console.log('foo');
+ console.log.apply(console, arguments);
+ }
+ expect: {
+ console.log('foo');
+ console.log.apply(console, arguments);
+ }
+}
+
+drop_console_2: {
+ options = { drop_console: true };
+ input: {
+ console.log('foo');
+ console.log.apply(console, arguments);
+ }
+ expect: {
+ // with regular compression these will be stripped out as well
+ void 0;
+ void 0;
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list