diff --git a/test/form/unused-var/_config.js b/test/form/unused-var/_config.js new file mode 100644 index 0000000..b89eb86 --- /dev/null +++ b/test/form/unused-var/_config.js @@ -0,0 +1,3 @@ +module.exports = { + description: 'omits unused var declaration' +}; diff --git a/test/form/unused-var/_expected/amd.js b/test/form/unused-var/_expected/amd.js new file mode 100644 index 0000000..29e6e69 --- /dev/null +++ b/test/form/unused-var/_expected/amd.js @@ -0,0 +1,7 @@ +define(function () { 'use strict'; + + var foo = 'lol'; + + console.log( foo ); + +}); diff --git a/test/form/unused-var/_expected/cjs.js b/test/form/unused-var/_expected/cjs.js new file mode 100644 index 0000000..4e96ed5 --- /dev/null +++ b/test/form/unused-var/_expected/cjs.js @@ -0,0 +1,5 @@ +'use strict'; + +var foo = 'lol'; + +console.log( foo ); diff --git a/test/form/unused-var/_expected/es6.js b/test/form/unused-var/_expected/es6.js new file mode 100644 index 0000000..80d05d2 --- /dev/null +++ b/test/form/unused-var/_expected/es6.js @@ -0,0 +1,3 @@ +var foo = 'lol'; + +console.log( foo ); diff --git a/test/form/unused-var/_expected/iife.js b/test/form/unused-var/_expected/iife.js new file mode 100644 index 0000000..e50863d --- /dev/null +++ b/test/form/unused-var/_expected/iife.js @@ -0,0 +1,8 @@ +(function () { + 'use strict'; + + var foo = 'lol'; + + console.log( foo ); + +}()); diff --git a/test/form/unused-var/_expected/umd.js b/test/form/unused-var/_expected/umd.js new file mode 100644 index 0000000..ed0baa3 --- /dev/null +++ b/test/form/unused-var/_expected/umd.js @@ -0,0 +1,11 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, function () { 'use strict'; + + var foo = 'lol'; + + console.log( foo ); + +})); diff --git a/test/form/unused-var/foo.js b/test/form/unused-var/foo.js new file mode 100644 index 0000000..3b60a87 --- /dev/null +++ b/test/form/unused-var/foo.js @@ -0,0 +1,6 @@ +var foo = 'lol'; +var bar = 'wut'; + +var baz = bar || foo; + +export { foo }; diff --git a/test/form/unused-var/main.js b/test/form/unused-var/main.js new file mode 100644 index 0000000..1b3e409 --- /dev/null +++ b/test/form/unused-var/main.js @@ -0,0 +1,2 @@ +import { foo } from './foo.js'; +console.log( foo ); diff --git a/test/function/tracks-late-alias-mutations/_config.js b/test/function/tracks-late-alias-mutations/_config.js new file mode 100644 index 0000000..15906f8 --- /dev/null +++ b/test/function/tracks-late-alias-mutations/_config.js @@ -0,0 +1,3 @@ +module.exports = { + description: 'tracks mutations of late aliases' +}; diff --git a/test/function/tracks-late-alias-mutations/bar.js b/test/function/tracks-late-alias-mutations/bar.js new file mode 100644 index 0000000..f82bb7a --- /dev/null +++ b/test/function/tracks-late-alias-mutations/bar.js @@ -0,0 +1,7 @@ +import { foo } from './foo'; + +var f; +f = foo; +f.wasMutated = true; + +export var bar = 'whatever'; diff --git a/test/function/tracks-late-alias-mutations/foo.js b/test/function/tracks-late-alias-mutations/foo.js new file mode 100644 index 0000000..386f265 --- /dev/null +++ b/test/function/tracks-late-alias-mutations/foo.js @@ -0,0 +1 @@ +export var foo = {}; diff --git a/test/function/tracks-late-alias-mutations/main.js b/test/function/tracks-late-alias-mutations/main.js new file mode 100644 index 0000000..7cf7ee2 --- /dev/null +++ b/test/function/tracks-late-alias-mutations/main.js @@ -0,0 +1,4 @@ +import { foo } from './foo'; +import { bar } from './bar'; + +assert.ok( foo.wasMutated );