From 82f2149a1818f5754db9c361e0f604d412bf27fe Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Mon, 26 Sep 2016 09:49:32 -0700 Subject: [PATCH] Add another failing test case. --- .../form/unused-called-with-side-effects/_config.js | 3 +++ .../_expected/amd.js | 9 +++++++++ .../_expected/cjs.js | 7 +++++++ .../unused-called-with-side-effects/_expected/es.js | 5 +++++ .../_expected/iife.js | 10 ++++++++++ .../_expected/umd.js | 13 +++++++++++++ test/form/unused-called-with-side-effects/main.js | 13 +++++++++++++ 7 files changed, 60 insertions(+) create mode 100644 test/form/unused-called-with-side-effects/_config.js create mode 100644 test/form/unused-called-with-side-effects/_expected/amd.js create mode 100644 test/form/unused-called-with-side-effects/_expected/cjs.js create mode 100644 test/form/unused-called-with-side-effects/_expected/es.js create mode 100644 test/form/unused-called-with-side-effects/_expected/iife.js create mode 100644 test/form/unused-called-with-side-effects/_expected/umd.js create mode 100644 test/form/unused-called-with-side-effects/main.js diff --git a/test/form/unused-called-with-side-effects/_config.js b/test/form/unused-called-with-side-effects/_config.js new file mode 100644 index 0000000..0f1029d --- /dev/null +++ b/test/form/unused-called-with-side-effects/_config.js @@ -0,0 +1,3 @@ +module.exports = { + description: 'does not include called-in-unused-code import' +}; diff --git a/test/form/unused-called-with-side-effects/_expected/amd.js b/test/form/unused-called-with-side-effects/_expected/amd.js new file mode 100644 index 0000000..8be9631 --- /dev/null +++ b/test/form/unused-called-with-side-effects/_expected/amd.js @@ -0,0 +1,9 @@ +define(function () { 'use strict'; + + function foo() { + return 'foo' + } + + assert.equal( foo(), 'foo' ); + +}); diff --git a/test/form/unused-called-with-side-effects/_expected/cjs.js b/test/form/unused-called-with-side-effects/_expected/cjs.js new file mode 100644 index 0000000..9cd0d53 --- /dev/null +++ b/test/form/unused-called-with-side-effects/_expected/cjs.js @@ -0,0 +1,7 @@ +'use strict'; + +function foo() { + return 'foo' +} + +assert.equal( foo(), 'foo' ); diff --git a/test/form/unused-called-with-side-effects/_expected/es.js b/test/form/unused-called-with-side-effects/_expected/es.js new file mode 100644 index 0000000..1ea92fc --- /dev/null +++ b/test/form/unused-called-with-side-effects/_expected/es.js @@ -0,0 +1,5 @@ +function foo() { + return 'foo' +} + +assert.equal( foo(), 'foo' ); diff --git a/test/form/unused-called-with-side-effects/_expected/iife.js b/test/form/unused-called-with-side-effects/_expected/iife.js new file mode 100644 index 0000000..ccdb513 --- /dev/null +++ b/test/form/unused-called-with-side-effects/_expected/iife.js @@ -0,0 +1,10 @@ +(function () { + 'use strict'; + + function foo() { + return 'foo' + } + + assert.equal( foo(), 'foo' ); + +}()); diff --git a/test/form/unused-called-with-side-effects/_expected/umd.js b/test/form/unused-called-with-side-effects/_expected/umd.js new file mode 100644 index 0000000..e3ea51f --- /dev/null +++ b/test/form/unused-called-with-side-effects/_expected/umd.js @@ -0,0 +1,13 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, (function () { 'use strict'; + + function foo() { + return 'foo' + } + + assert.equal( foo(), 'foo' ); + +}))); diff --git a/test/form/unused-called-with-side-effects/main.js b/test/form/unused-called-with-side-effects/main.js new file mode 100644 index 0000000..25de8d8 --- /dev/null +++ b/test/form/unused-called-with-side-effects/main.js @@ -0,0 +1,13 @@ +function foo() { + return 'foo' +} + +function bar() { + dead(); +} + +function dead() { + console.log('dead'); +} + +assert.equal( foo(), 'foo' );