From f4082776d569edc9577f6d10e6b2b3b4d9e4cb2e Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 22 Sep 2015 22:40:16 -0400 Subject: [PATCH] failing test for module order bug --- test/function/module-sort-order/_config.js | 5 +++++ test/function/module-sort-order/a.js | 20 ++++++++++++++++++++ test/function/module-sort-order/b.js | 1 + test/function/module-sort-order/c.js | 3 +++ test/function/module-sort-order/main.js | 4 ++++ test/function/module-sort-order/z.js | 5 +++++ 6 files changed, 38 insertions(+) create mode 100644 test/function/module-sort-order/_config.js create mode 100644 test/function/module-sort-order/a.js create mode 100644 test/function/module-sort-order/b.js create mode 100644 test/function/module-sort-order/c.js create mode 100644 test/function/module-sort-order/main.js create mode 100644 test/function/module-sort-order/z.js diff --git a/test/function/module-sort-order/_config.js b/test/function/module-sort-order/_config.js new file mode 100644 index 0000000..a84538d --- /dev/null +++ b/test/function/module-sort-order/_config.js @@ -0,0 +1,5 @@ +module.exports = { + // solo: true, + // show: true, + description: 'module sorter is not confused by top-level call expressions' +}; diff --git a/test/function/module-sort-order/a.js b/test/function/module-sort-order/a.js new file mode 100644 index 0000000..cf43071 --- /dev/null +++ b/test/function/module-sort-order/a.js @@ -0,0 +1,20 @@ +import { b } from './b'; +import z from './z'; + +z(); + +const p = { + q: function () { + b.nope(); + } +}; + +(function () { + const p = { + q: function () { + b.nope(); + } + }; +})(); + +export default 42; diff --git a/test/function/module-sort-order/b.js b/test/function/module-sort-order/b.js new file mode 100644 index 0000000..3a7e6b7 --- /dev/null +++ b/test/function/module-sort-order/b.js @@ -0,0 +1 @@ +export const b = function () {}; diff --git a/test/function/module-sort-order/c.js b/test/function/module-sort-order/c.js new file mode 100644 index 0000000..4bbf7c1 --- /dev/null +++ b/test/function/module-sort-order/c.js @@ -0,0 +1,3 @@ +import { b } from './b'; + +export const c = function () {}; diff --git a/test/function/module-sort-order/main.js b/test/function/module-sort-order/main.js new file mode 100644 index 0000000..dcd42cb --- /dev/null +++ b/test/function/module-sort-order/main.js @@ -0,0 +1,4 @@ +import a from './a'; +import z from './z'; + +z(); diff --git a/test/function/module-sort-order/z.js b/test/function/module-sort-order/z.js new file mode 100644 index 0000000..8b67172 --- /dev/null +++ b/test/function/module-sort-order/z.js @@ -0,0 +1,5 @@ +import { c } from './c'; + +export default function () { + c(); +}