From 5e80ffa3aaa6f916e62764445b597ae6e155ff62 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 20 Jul 2015 09:53:29 -0400 Subject: [PATCH] another test for #37 --- test/form/exclude-unnecessary-modifications/_config.js | 3 ++- .../exclude-unnecessary-modifications/_expected/amd.js | 10 ++++++++-- .../exclude-unnecessary-modifications/_expected/cjs.js | 10 ++++++++-- .../exclude-unnecessary-modifications/_expected/es6.js | 10 ++++++++-- .../_expected/iife.js | 10 ++++++++-- .../exclude-unnecessary-modifications/_expected/umd.js | 10 ++++++++-- test/form/exclude-unnecessary-modifications/foo.js | 10 ++++++++-- 7 files changed, 50 insertions(+), 13 deletions(-) diff --git a/test/form/exclude-unnecessary-modifications/_config.js b/test/form/exclude-unnecessary-modifications/_config.js index 2b3de2b..c66ce85 100644 --- a/test/form/exclude-unnecessary-modifications/_config.js +++ b/test/form/exclude-unnecessary-modifications/_config.js @@ -1,3 +1,4 @@ module.exports = { - description: 'statements that modify definitions within unused functions are excluded' + description: 'statements that modify definitions within unused functions are excluded', + solo: true }; diff --git a/test/form/exclude-unnecessary-modifications/_expected/amd.js b/test/form/exclude-unnecessary-modifications/_expected/amd.js index 2cde378..84befa4 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/amd.js +++ b/test/form/exclude-unnecessary-modifications/_expected/amd.js @@ -13,10 +13,16 @@ define(function () { 'use strict'; foo[ letter ] = i; }); - function mutate1 ( obj ) { - obj.mutated = 1; + function mutate1 () { + foo.mutated = 1; } + ({ + mutate2: function () { + foo.mutated = 2; + } + }).mutate2(); + console.log( foo ); }); diff --git a/test/form/exclude-unnecessary-modifications/_expected/cjs.js b/test/form/exclude-unnecessary-modifications/_expected/cjs.js index c440046..596c910 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/cjs.js +++ b/test/form/exclude-unnecessary-modifications/_expected/cjs.js @@ -13,8 +13,14 @@ mutate1( foo ); foo[ letter ] = i; }); -function mutate1 ( obj ) { - obj.mutated = 1; +function mutate1 () { + foo.mutated = 1; } +({ + mutate2: function () { + foo.mutated = 2; + } +}).mutate2(); + console.log( foo ); diff --git a/test/form/exclude-unnecessary-modifications/_expected/es6.js b/test/form/exclude-unnecessary-modifications/_expected/es6.js index 57365ac..a88d21e 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/es6.js +++ b/test/form/exclude-unnecessary-modifications/_expected/es6.js @@ -11,8 +11,14 @@ mutate1( foo ); foo[ letter ] = i; }); -function mutate1 ( obj ) { - obj.mutated = 1; +function mutate1 () { + foo.mutated = 1; } +({ + mutate2: function () { + foo.mutated = 2; + } +}).mutate2(); + console.log( foo ); diff --git a/test/form/exclude-unnecessary-modifications/_expected/iife.js b/test/form/exclude-unnecessary-modifications/_expected/iife.js index 3063464..0fd4c40 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/iife.js +++ b/test/form/exclude-unnecessary-modifications/_expected/iife.js @@ -13,10 +13,16 @@ foo[ letter ] = i; }); - function mutate1 ( obj ) { - obj.mutated = 1; + function mutate1 () { + foo.mutated = 1; } + ({ + mutate2: function () { + foo.mutated = 2; + } + }).mutate2(); + console.log( foo ); })(); diff --git a/test/form/exclude-unnecessary-modifications/_expected/umd.js b/test/form/exclude-unnecessary-modifications/_expected/umd.js index 55207a5..1c2bb78 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/umd.js +++ b/test/form/exclude-unnecessary-modifications/_expected/umd.js @@ -17,10 +17,16 @@ foo[ letter ] = i; }); - function mutate1 ( obj ) { - obj.mutated = 1; + function mutate1 () { + foo.mutated = 1; } + ({ + mutate2: function () { + foo.mutated = 2; + } + }).mutate2(); + console.log( foo ); })); diff --git a/test/form/exclude-unnecessary-modifications/foo.js b/test/form/exclude-unnecessary-modifications/foo.js index 268c0b9..71e1e93 100644 --- a/test/form/exclude-unnecessary-modifications/foo.js +++ b/test/form/exclude-unnecessary-modifications/foo.js @@ -11,10 +11,16 @@ mutate1( foo ); foo[ letter ] = i; }); -function mutate1 ( obj ) { - obj.mutated = 1; +function mutate1 () { + foo.mutated = 1; } +({ + mutate2: function () { + foo.mutated = 2; + } +}).mutate2(); + // should be excluded var mutate2 = function () { foo.mutated = 2;