From cdc721cc71cc58f88c457f13f6d479a671f0b09c Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 19 Jul 2015 10:16:47 -0400 Subject: [PATCH] more tests for #37 --- .../_expected/amd.js | 6 ++++- .../_expected/cjs.js | 6 ++++- .../_expected/es6.js | 6 ++++- .../_expected/iife.js | 6 ++++- .../_expected/umd.js | 6 ++++- .../exclude-unnecessary-modifications/foo.js | 24 ++++++++++++++++++- 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/test/form/exclude-unnecessary-modifications/_expected/amd.js b/test/form/exclude-unnecessary-modifications/_expected/amd.js index 21da4e1..2cde378 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/amd.js +++ b/test/form/exclude-unnecessary-modifications/_expected/amd.js @@ -7,7 +7,11 @@ define(function () { 'use strict'; // should be included [ 'a', 'b', 'c' ].forEach( function ( letter, i ) { foo[ letter ] = i; - }) + }); + + [ 'd', 'e', 'f' ].forEach( ( letter, i ) => { + foo[ letter ] = i; + }); function mutate1 ( obj ) { obj.mutated = 1; diff --git a/test/form/exclude-unnecessary-modifications/_expected/cjs.js b/test/form/exclude-unnecessary-modifications/_expected/cjs.js index e3e9a0a..c440046 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/cjs.js +++ b/test/form/exclude-unnecessary-modifications/_expected/cjs.js @@ -7,7 +7,11 @@ mutate1( foo ); // should be included [ 'a', 'b', 'c' ].forEach( function ( letter, i ) { foo[ letter ] = i; -}) +}); + +[ 'd', 'e', 'f' ].forEach( ( letter, i ) => { + foo[ letter ] = i; +}); function mutate1 ( obj ) { obj.mutated = 1; diff --git a/test/form/exclude-unnecessary-modifications/_expected/es6.js b/test/form/exclude-unnecessary-modifications/_expected/es6.js index 33e349f..57365ac 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/es6.js +++ b/test/form/exclude-unnecessary-modifications/_expected/es6.js @@ -5,7 +5,11 @@ mutate1( foo ); // should be included [ 'a', 'b', 'c' ].forEach( function ( letter, i ) { foo[ letter ] = i; -}) +}); + +[ 'd', 'e', 'f' ].forEach( ( letter, i ) => { + foo[ letter ] = i; +}); function mutate1 ( obj ) { obj.mutated = 1; diff --git a/test/form/exclude-unnecessary-modifications/_expected/iife.js b/test/form/exclude-unnecessary-modifications/_expected/iife.js index 5919cbf..3063464 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/iife.js +++ b/test/form/exclude-unnecessary-modifications/_expected/iife.js @@ -7,7 +7,11 @@ // should be included [ 'a', 'b', 'c' ].forEach( function ( letter, i ) { foo[ letter ] = i; - }) + }); + + [ 'd', 'e', 'f' ].forEach( ( letter, i ) => { + foo[ letter ] = i; + }); function mutate1 ( obj ) { obj.mutated = 1; diff --git a/test/form/exclude-unnecessary-modifications/_expected/umd.js b/test/form/exclude-unnecessary-modifications/_expected/umd.js index 58ecb8d..55207a5 100644 --- a/test/form/exclude-unnecessary-modifications/_expected/umd.js +++ b/test/form/exclude-unnecessary-modifications/_expected/umd.js @@ -11,7 +11,11 @@ // should be included [ 'a', 'b', 'c' ].forEach( function ( letter, i ) { foo[ letter ] = i; - }) + }); + + [ 'd', 'e', 'f' ].forEach( ( letter, i ) => { + foo[ letter ] = i; + }); function mutate1 ( obj ) { obj.mutated = 1; diff --git a/test/form/exclude-unnecessary-modifications/foo.js b/test/form/exclude-unnecessary-modifications/foo.js index 05f7e0b..268c0b9 100644 --- a/test/form/exclude-unnecessary-modifications/foo.js +++ b/test/form/exclude-unnecessary-modifications/foo.js @@ -5,7 +5,11 @@ mutate1( foo ); // should be included [ 'a', 'b', 'c' ].forEach( function ( letter, i ) { foo[ letter ] = i; -}) +}); + +[ 'd', 'e', 'f' ].forEach( ( letter, i ) => { + foo[ letter ] = i; +}); function mutate1 ( obj ) { obj.mutated = 1; @@ -24,4 +28,22 @@ function unused2 () { mutate1( foo ); } +var obj1 = { + mutate3 () { foo.mutated = 3; } +}; + +var obj2 = { + mutate4: function () { foo.mutated = 4; } +}; + +var obj3 = { + mutate5: () => foo.mutated = 5 +}; + +class Mutator { + mutate6 () { + foo.mutated = 6; + } +} + export default foo;