08-27-周三_17-09-29

This commit is contained in:
2025-08-27 17:10:05 +08:00
commit 86df397d8f
12735 changed files with 1145479 additions and 0 deletions

34
node_modules/dnode/test/self-referential.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
var dnode = require('../')
var test = require('tape');
test('self-referential', function (t) {
t.plan(7);
var server = dnode({
timesTen : function (n,reply) {
t.equal(n.number, 5);
reply(n.number * 10);
},
print : function (n,reply) {
t.strictEqual(n[0],1);
t.strictEqual(n[1],2);
t.strictEqual(n[2],3);
t.strictEqual(n[3],n);
reply(n);
}
});
var client = dnode();
client.on('remote', function (remote) {
var args = [1,2,3]
args.push(args)
remote.print(args, function (m) {
t.same(m.slice(0,3), args.slice(0,3));
t.equal(m, m[3]);
t.equal(args, args[3]);
});
});
client.pipe(server).pipe(client);
});