[Pkg-javascript-commits] [node-module-deps] 109/444: passing unicode test

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


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

rouca pushed a commit to branch master
in repository node-module-deps.

commit a4e22763832f9fbefe083b383123dafe769976b9
Author: James Halliday <mail at substack.net>
Date:   Sun Jun 23 01:17:24 2013 -0700

    passing unicode test
---
 test/files/unicode/bar.js  |  3 +++
 test/files/unicode/foo.js  |  5 +++++
 test/files/unicode/main.js |  2 ++
 test/unicode.js            | 42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+)

diff --git a/test/files/unicode/bar.js b/test/files/unicode/bar.js
new file mode 100644
index 0000000..7ebb0ae
--- /dev/null
+++ b/test/files/unicode/bar.js
@@ -0,0 +1,3 @@
+module.exports = function (ñ) {
+    return ñ * 100;
+};
diff --git a/test/files/unicode/foo.js b/test/files/unicode/foo.js
new file mode 100644
index 0000000..6541c71
--- /dev/null
+++ b/test/files/unicode/foo.js
@@ -0,0 +1,5 @@
+var é = require('./bar');
+
+module.exports = function (ñ) {
+    return ñ * 111 + é(n);
+};
diff --git a/test/files/unicode/main.js b/test/files/unicode/main.js
new file mode 100644
index 0000000..bb2095e
--- /dev/null
+++ b/test/files/unicode/main.js
@@ -0,0 +1,2 @@
+var π = require('./foo');
+console.log('main: ' + foo(5));
diff --git a/test/unicode.js b/test/unicode.js
new file mode 100644
index 0000000..8638d79
--- /dev/null
+++ b/test/unicode.js
@@ -0,0 +1,42 @@
+var parser = require('../');
+var test = require('tap').test;
+var fs = require('fs');
+
+var files = {
+    main: __dirname + '/files/unicode/main.js',
+    foo: __dirname + '/files/unicode/foo.js',
+    bar: __dirname + '/files/unicode/bar.js'
+};
+
+var sources = Object.keys(files).reduce(function (acc, file) {
+    acc[file] = fs.readFileSync(files[file], 'utf8');
+    return acc;
+}, {});
+
+test('unicode deps', function (t) {
+    t.plan(1);
+    var p = parser(files.main);
+    var rows = [];
+    
+    p.on('data', function (row) { rows.push(row) });
+    p.on('end', function () {
+        t.same(rows, [
+            {
+                id: files.main,
+                source: sources.main,
+                entry: true,
+                deps: { './foo': files.foo }
+            },
+            {
+                id: files.foo,
+                source: sources.foo,
+                deps: { './bar': files.bar }
+            },
+            {
+                id: files.bar,
+                source: sources.bar,
+                deps: {}
+            }
+        ]);
+    });
+});

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



More information about the Pkg-javascript-commits mailing list