[Pkg-javascript-commits] [node-lexical-scope] 45/83: Add test for multiple functions assigned as rhs of exp

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:45:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-lexical-scope.

commit 29fec872ef31678a3ce7ada7ce553dd02c65c7f2
Author: ForbesLindesay <forbes at lindesay.co.uk>
Date:   Fri May 31 11:48:25 2013 +0100

    Add test for multiple functions assigned as rhs of exp
    
    see #13
---
 test/files/multiple-exports.js |  6 ++++++
 test/multiple-exports.js       | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/test/files/multiple-exports.js b/test/files/multiple-exports.js
new file mode 100644
index 0000000..df549c1
--- /dev/null
+++ b/test/files/multiple-exports.js
@@ -0,0 +1,6 @@
+exports.foo = function () {
+  return bar;
+};
+exports.bar = function (bar) {
+  return bar;
+};
\ No newline at end of file
diff --git a/test/multiple-exports.js b/test/multiple-exports.js
new file mode 100644
index 0000000..990d068
--- /dev/null
+++ b/test/multiple-exports.js
@@ -0,0 +1,18 @@
+
+var test = require('tape');
+var detect = require('../');
+var fs = require('fs');
+var src = fs.readFileSync(__dirname + '/files/multiple-exports.js');
+
+test('multiple-exports', function (t) {
+    t.plan(3);
+    
+    var scope = detect(src);
+    t.same(scope.globals.implicit.sort(), ['bar', 'exports'].sort());
+    t.same(scope.globals.exported, []);
+    t.same(scope.locals,  {
+      '':[],
+      'body.1.expression.right': ['bar'],
+      'body.0.expression.right': []
+    });
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-lexical-scope.git



More information about the Pkg-javascript-commits mailing list