[Pkg-javascript-commits] [node-lexical-scope] 56/83: Add test for variables introduced by `catch`
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:45:51 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 dc589e9a4f79c6dc6823e6df381e7e67c260cdf2
Author: ForbesLindesay <forbes at lindesay.co.uk>
Date: Tue May 21 10:02:32 2013 +0100
Add test for variables introduced by `catch`
see #8
---
test/files/try_catch.js | 7 +++++++
test/try_catch.js | 13 +++++++++++++
2 files changed, 20 insertions(+)
diff --git a/test/files/try_catch.js b/test/files/try_catch.js
new file mode 100644
index 0000000..711aeb2
--- /dev/null
+++ b/test/files/try_catch.js
@@ -0,0 +1,7 @@
+function foo() {
+ try {
+
+ } catch (ex) {
+ foo(ex)
+ }
+}
\ No newline at end of file
diff --git a/test/try_catch.js b/test/try_catch.js
new file mode 100644
index 0000000..80d11cb
--- /dev/null
+++ b/test/try_catch.js
@@ -0,0 +1,13 @@
+var test = require('tape');
+var detect = require('../');
+var fs = require('fs');
+var src = fs.readFileSync(__dirname + '/files/try_catch.js');
+
+test('the exception in a try catch block is a local', function (t) {
+ t.plan(3);
+
+ var scope = detect(src);
+ t.same(scope.globals.implicit, []);
+ t.same(scope.globals.exported, []);
+ t.same(scope.locals, { '': [ 'foo' ], 'body.0': [ 'ex' ] });
+});
--
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