[Pkg-javascript-commits] [node-browser-unpack] 27/40: passing return test

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 12:27:25 UTC 2017


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

rouca pushed a commit to branch master
in repository node-browser-unpack.

commit c27d68ab2f5b9f2df10ad6c69fbce2bf1c9023cf
Author: James Halliday <mail at substack.net>
Date:   Sun Jul 19 01:49:10 2015 -0700

    passing return test
---
 package.json              |  1 +
 test/files/return.js      |  4 ++++
 test/files/return/main.js |  1 +
 test/return.js            | 25 +++++++++++++++++++++++++
 4 files changed, 31 insertions(+)

diff --git a/package.json b/package.json
index 6d0e58f..d64ac47 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
     "browser-unpack": "bin/cmd.js"
   },
   "dependencies": {
+    "acorn": "^1.0.3",
     "concat-stream": "~1.2.1",
     "esprima-fb": "3001.1.0-dev-harmony-fb",
     "minimist": "0.0.5"
diff --git a/test/files/return.js b/test/files/return.js
new file mode 100644
index 0000000..fd9fe1c
--- /dev/null
+++ b/test/files/return.js
@@ -0,0 +1,4 @@
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+return console.log('whatever');
+
+},{}]},{},[1]);
diff --git a/test/files/return/main.js b/test/files/return/main.js
new file mode 100644
index 0000000..eaeb5ad
--- /dev/null
+++ b/test/files/return/main.js
@@ -0,0 +1 @@
+return console.log('whatever');
diff --git a/test/return.js b/test/return.js
new file mode 100644
index 0000000..10a5001
--- /dev/null
+++ b/test/return.js
@@ -0,0 +1,25 @@
+var test = require('tape');
+var unpack = require('../');
+var pack = require('browser-pack');
+var concat = require('concat-stream');
+var vm = require('vm');
+
+var fs = require('fs');
+var src = fs.readFileSync(__dirname + '/files/return.js', 'utf8');
+
+test('return', function (t) {
+    t.plan(1);
+    
+    var p = pack({ raw: true });
+    p.pipe(concat(function (body) {
+        var log = function (msg) {
+            t.equal(msg, 'whatever');
+        };
+        var c = { console: { log: log } };
+        vm.runInNewContext(body.toString('utf8'), c);
+    }));
+    
+    var rows = unpack(src);
+    rows.forEach(function (row) { p.write(row) });
+    p.end();
+});

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



More information about the Pkg-javascript-commits mailing list