From fddf71d4a8f359ef23df6180b12bab32f8e72161 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sat, 22 Aug 2015 12:09:37 -0400 Subject: [PATCH] update test to reflect bug accurately --- test/function/functions-renamed-correctly/_config.js | 5 +++++ test/function/functions-renamed-correctly/after.js | 5 +++++ test/function/functions-renamed-correctly/before.js | 5 +++++ test/function/functions-renamed-correctly/factorial.js | 7 +++++++ test/function/functions-renamed-correctly/main.js | 7 +++++++ test/function/shadowed-exported-var/_config.js | 9 --------- test/function/shadowed-exported-var/main.js | 9 --------- 7 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 test/function/functions-renamed-correctly/_config.js create mode 100644 test/function/functions-renamed-correctly/after.js create mode 100644 test/function/functions-renamed-correctly/before.js create mode 100644 test/function/functions-renamed-correctly/factorial.js create mode 100644 test/function/functions-renamed-correctly/main.js delete mode 100644 test/function/shadowed-exported-var/_config.js delete mode 100644 test/function/shadowed-exported-var/main.js diff --git a/test/function/functions-renamed-correctly/_config.js b/test/function/functions-renamed-correctly/_config.js new file mode 100644 index 0000000..3c7a2e8 --- /dev/null +++ b/test/function/functions-renamed-correctly/_config.js @@ -0,0 +1,5 @@ +module.exports = { + description: 'renames function expression IDs correctly', + show: true, + solo: true +}; diff --git a/test/function/functions-renamed-correctly/after.js b/test/function/functions-renamed-correctly/after.js new file mode 100644 index 0000000..b46f71f --- /dev/null +++ b/test/function/functions-renamed-correctly/after.js @@ -0,0 +1,5 @@ +function x () { + console.log( 'after' ); +} + +export { x as after }; diff --git a/test/function/functions-renamed-correctly/before.js b/test/function/functions-renamed-correctly/before.js new file mode 100644 index 0000000..4c91def --- /dev/null +++ b/test/function/functions-renamed-correctly/before.js @@ -0,0 +1,5 @@ +function x () { + console.log( 'before' ); +} + +export { x as before }; diff --git a/test/function/functions-renamed-correctly/factorial.js b/test/function/functions-renamed-correctly/factorial.js new file mode 100644 index 0000000..9f5e752 --- /dev/null +++ b/test/function/functions-renamed-correctly/factorial.js @@ -0,0 +1,7 @@ +var x = (function () { + return function x ( num ) { + return num <= 2 ? num : num * x( num - 1 ); + }; +})(); + +export { x }; diff --git a/test/function/functions-renamed-correctly/main.js b/test/function/functions-renamed-correctly/main.js new file mode 100644 index 0000000..bfa167c --- /dev/null +++ b/test/function/functions-renamed-correctly/main.js @@ -0,0 +1,7 @@ +import { before } from './before'; +import { x } from './factorial'; +import { after } from './after'; + +before(); +assert.equal( x( 5 ), 120 ); +after(); diff --git a/test/function/shadowed-exported-var/_config.js b/test/function/shadowed-exported-var/_config.js deleted file mode 100644 index 4c46165..0000000 --- a/test/function/shadowed-exported-var/_config.js +++ /dev/null @@ -1,9 +0,0 @@ -var assert = require( 'assert' ); - -module.exports = { - description: 'handles shadowed exported variable', - exports: function ( exports ) { - assert.equal( exports.foo(), 42 ); - }, - // solo: true -}; diff --git a/test/function/shadowed-exported-var/main.js b/test/function/shadowed-exported-var/main.js deleted file mode 100644 index fc657a6..0000000 --- a/test/function/shadowed-exported-var/main.js +++ /dev/null @@ -1,9 +0,0 @@ -var foo; - -foo = (function () { - return function foo () { - return 42; - }; -})(); - -export { foo };