[Pkg-javascript-commits] [node-lexical-scope] 73/83: tests for implicit properties

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:45:53 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 1bf9313e8820844ed34d12524fd0cf9c6ca21111
Author: James Halliday <mail at substack.net>
Date:   Fri Sep 18 12:13:47 2015 -0700

    tests for implicit properties
---
 test/files/buffer_call.js     |  1 +
 test/files/buffer_isbuffer.js |  1 +
 test/files/buffer_var.js      |  1 +
 test/props.js                 | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+)

diff --git a/test/files/buffer_call.js b/test/files/buffer_call.js
new file mode 100644
index 0000000..db1f8a4
--- /dev/null
+++ b/test/files/buffer_call.js
@@ -0,0 +1 @@
+console.log(Buffer('abc'))
diff --git a/test/files/buffer_isbuffer.js b/test/files/buffer_isbuffer.js
new file mode 100644
index 0000000..a0759ca
--- /dev/null
+++ b/test/files/buffer_isbuffer.js
@@ -0,0 +1 @@
+console.log(Buffer.isBuffer('whatever'))
diff --git a/test/files/buffer_var.js b/test/files/buffer_var.js
new file mode 100644
index 0000000..dd98588
--- /dev/null
+++ b/test/files/buffer_var.js
@@ -0,0 +1 @@
+console.log(Buffer)
diff --git a/test/props.js b/test/props.js
new file mode 100644
index 0000000..08d5e89
--- /dev/null
+++ b/test/props.js
@@ -0,0 +1,41 @@
+var test = require('tape');
+var detect = require('../');
+var fs = require('fs');
+var src = {
+    call: fs.readFileSync(__dirname + '/files/buffer_call.js'),
+    isbuffer: fs.readFileSync(__dirname + '/files/buffer_isbuffer.js'),
+    v: fs.readFileSync(__dirname + '/files/buffer_var.js')
+};
+
+test('implicit props: call', function (t) {
+    t.plan(3);
+    var scope = detect(src.call);
+    t.deepEqual(scope.locals, { '': [] });
+    t.deepEqual(scope.globals.implicit, [ 'console', 'Buffer' ]);
+    t.deepEqual(scope.globals.implicitProperties, {
+        console: [ 'log' ],
+        Buffer: [ '()' ]
+    })
+});
+
+test('implicit props: isBuffer', function (t) {
+    t.plan(3);
+    var scope = detect(src.isbuffer);
+    t.deepEqual(scope.locals, { '': [] });
+    t.deepEqual(scope.globals.implicit, [ 'console', 'Buffer' ]);
+    t.deepEqual(scope.globals.implicitProperties, {
+        console: [ 'log' ],
+        Buffer: [ 'isBuffer' ]
+    })
+});
+
+test('implicit props: var', function (t) {
+    t.plan(3);
+    var scope = detect(src.v);
+    t.deepEqual(scope.locals, { '': [] });
+    t.deepEqual(scope.globals.implicit, [ 'console', 'Buffer' ]);
+    t.deepEqual(scope.globals.implicitProperties, {
+        console: [ 'log' ],
+        Buffer: [ '*' ]
+    })
+});

-- 
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