11 |
12 | void dlmallocfork_restore (void* _source, int source_max, void* _target, int target_max);
13 | void dlmallocfork_save (void* _source, int source_max, void* _target, int target_max);
14 | size_t dlmallocfork_save_size (void* _ptr, int max);
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_fs.lua:
--------------------------------------------------------------------------------
1 | function link_dir (dir, base)
2 | local path = base.."/"..dir
3 | local mode = lfs.attributes (path).mode
4 | if mode == "directory" then
5 | return string.format ('%s',
6 | cgilua.mkurlpath ("test_fs.lua", { dir = path }),
7 | dir)
8 | else
9 | return dir
10 | end
11 | end
12 |
13 | cgilua.htmlheader ()
14 | cgilua.put ("Testing Filesystem library
\n")
15 | cgilua.put ("\n")
16 | cgilua.put ("| Testing dir |
\n")
17 | local i = 0
18 | local dir = cgi.dir or "."
19 | for file in lfs.dir (dir) do
20 | i = i+1
21 | cgilua.put ("| "..i.." | "..link_dir(file, dir).." |
\n")
22 | end
23 | cgilua.put ("
\n")
24 |
--------------------------------------------------------------------------------
/test/suite/process.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(7);
4 |
5 | tap.eq(typeof process.version, 'string', 'process version exists as a string');
6 |
7 | var start = process.hrtime();
8 | setTimeout(function () {
9 | var diff = process.hrtime(start);
10 |
11 | tap.ok(Array.isArray(start), 'hrtime returns an array')
12 | tap.eq(start.length, 2, 'hrtime returns a type of numbers')
13 | tap.eq(typeof start[0], 'number', 'hrtime returns an array')
14 | tap.eq(typeof start[1], 'number', 'hrtime returns an array')
15 |
16 | tap.ok(Array.isArray(diff), 'hr can take an argument and return a diff');
17 | tap.ok(diff[0] == start[0] ? diff[0] <= start : diff[0] < start[0], 'hrtime diff is lower than start')
18 | }, 100);
19 |
--------------------------------------------------------------------------------
/test/todo/https-get.js:
--------------------------------------------------------------------------------
1 | console.log('1..2')
2 |
3 | var https = require('https');
4 |
5 | // Temporary tessel catchall
6 | try {
7 | https.get("https://api.github.com/", function (res) {
8 | console.log('ok')
9 | console.log('# statusCode', res.statusCode)
10 |
11 | var buf = '';
12 | res.on('data', function (data) {
13 | console.log('# received', data.length, 'bytes');
14 | buf += String(data);
15 | })
16 | res.on('close', function () {
17 | console.log('# result:', JSON.parse(buf));
18 | console.log('ok');
19 | })
20 | }).on('error', function (e) {
21 | console.log('not ok -', e.message, 'error event #SKIP')
22 | });
23 | } catch (e) {
24 | console.log('not ok -', e.message, 'error thrown #SKIP')
25 | }
--------------------------------------------------------------------------------
/test/issues/issue-beta-213.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(7);
4 |
5 | var n = 0xF0F0F0F0E1;
6 | tap.ok(String(n) == '1034834473185');
7 | tap.ok(n.toString(10) == '1034834473185');
8 | console.log("# base 10:", n.toString(10), '==', '1034834473185');
9 | tap.ok(n.toString(16) == 'f0f0f0f0e1');
10 | console.log("# base 16:", n.toString(16), '==', 'f0f0f0f0e1');
11 |
12 | var n = 1034834473185;
13 | tap.ok(String(n) == '1034834473185');
14 | tap.ok(n.toString(10) == '1034834473185');
15 | console.log('# base 10:', n.toString(10), '==', '1034834473185');
16 | tap.ok(n.toString(16) == 'f0f0f0f0e1');
17 | console.log('# base 16:', n.toString(16), '==', 'f0f0f0f0e1');
18 |
19 | tap.ok((0xFFFFFFFF * 2) > 0xFFFFFFFF, "supports > 0xFFFFFFFF")
--------------------------------------------------------------------------------
/test/suite/tls.js:
--------------------------------------------------------------------------------
1 | var tls = require('tls'),
2 | tap = require('../tap');
3 |
4 | tap.count(3);
5 |
6 | var options = {
7 | host : 'www.google.com',
8 | port : 443,
9 | //rejectUnauthorized: false
10 | };
11 |
12 | var socket = tls.connect(options, function connected() {
13 | tap.eq(true, true, 'connect callback is called');
14 | });
15 |
16 | socket.once('secureConnect', function() {
17 | tap.eq(true, true, 'secureConnect event is called');
18 | socket.write('GET / HTTP/1.1\nAccept: */*\nHost: www.google.com\nUser-Agent: HTTPie/0.7.2\n\n');
19 | });
20 |
21 | socket.once('data', function(data) {
22 | tap.eq(data.length > 0, true, 'we got data back from google over a secure TCP socket');
23 | socket.destroy();
24 | });
25 |
26 |
27 |
--------------------------------------------------------------------------------
/test/todo/https-fail-sni.js:
--------------------------------------------------------------------------------
1 | console.log('1..2')
2 |
3 | var https = require('https');
4 | var dns = require('dns');
5 |
6 | // Temporary tessel catchall
7 | dns.resolve('sni.velox.ch', function (err, addresses) {
8 | https.get("https://" + addresses[0] + "/", function (res) {
9 | console.log('ok')
10 | console.log('# statusCode', res.statusCode)
11 |
12 | var buf = '';
13 | res.on('data', function (data) {
14 | console.log('# received', data.length, 'bytes');
15 | buf += String(data);
16 | })
17 | res.on('close', function () {
18 | console.log('# result:', buf);
19 | console.log('ok');
20 | })
21 | }).on('error', function (e) {
22 | console.log('not ok -', e.message, 'error event #SKIP')
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-162.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(1);
4 |
5 | var loopNum = 0;
6 |
7 | console.log('Starting outer loop.');
8 | var outerLoop = setInterval(function(){
9 | loopNum++;
10 | console.log('.. Starting inner loop #', loopNum);
11 | var myLoop = setInterval(function(){
12 | console.log('.. -- looped [10ms]');
13 | }, 10);
14 | setTimeout(function(){
15 | console.log('.. Clearing inner loop #' + loopNum + ' after 50ms. (5 iterations)');
16 | clearInterval(myLoop);
17 | }, 50);
18 | }, 60);
19 |
20 | setTimeout(function(){
21 | console.log('Stopping outer loop after 1000ms (' + (1000/60 - 1).toFixed(0) + ' iterations)');
22 | clearInterval(outerLoop);
23 | tap.ok(true);
24 | }, 1000);
25 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/prepara_sql2.lua:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/lua
2 |
3 | MAX_ROWS = arg[1] or 10
4 |
5 | require"postgres"
6 |
7 | local env = assert (luasql.postgres ())
8 | local conn = assert (env:connect ("luasql-test", "tomas"))
9 |
10 | -- Apaga restos de outros testes.
11 | conn:execute "drop table t2"
12 | conn:execute "drop table t1"
13 |
14 | -- Criando as tabelas.
15 | assert (conn:execute [[create table t1 (
16 | a int,
17 | b int
18 | )]])
19 | assert (conn:execute [[create table t2 (
20 | c int,
21 | d int
22 | )]])
23 |
24 | -- Preenchedo as tabelas.
25 | for i = 1, MAX_ROWS do
26 | local ii = 2*i
27 | assert (conn:execute (string.format ([[
28 | insert into t1 values (%d, %d);
29 | insert into t2 values (%d, %d);]],
30 | ii, i, ii, i)))
31 | end
32 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-140.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(3);
4 |
5 | function arreq (a, b) {
6 | if (a.length != b.length) {
7 | return false;
8 | }
9 | for (var i = 0; i < a.length; i++) {
10 | if (a[i] != b[i]) {
11 | return false;
12 | }
13 | }
14 | return true;
15 | }
16 |
17 | var header = [0x02, 0x02, 0x00];
18 | var data = new Array(0x02);
19 | tap.ok(header.concat(data).length == 5, 'array concat length')
20 | console.log('# -->', header.concat(data).length)
21 | tap.ok(arreq(header.concat(data), [2, 2, 0, undefined, undefined]), 'array concat')
22 | console.log('#', header.concat(data))
23 | tap.ok([2, 2, 0, undefined, undefined].length == 5, 'array length');
24 | console.log('#', [2, 2, 0, undefined, undefined].length);
25 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-342.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(6);
4 |
5 | var arg = "Hello Friends";
6 | var ret = Buffer.concat( [ arg ] );
7 | tap.eq(arg, ret);
8 |
9 | try {
10 | Buffer.concat( [ arg, arg ] );
11 | tap.ok(false);
12 | } catch (e) {
13 | tap.ok(e);
14 | }
15 |
16 | var a = new Buffer(16);
17 | var b = new Buffer(16);
18 | a.copy(b, 256, 0, 0);
19 | tap.ok(true);
20 |
21 | var rando = new Buffer(16);
22 | Buffer.concat([rando, rando], 32);
23 | Buffer.concat([rando, rando], 31);
24 | Buffer.concat([rando, rando], 128);
25 | tap.ok(true);
26 | try {
27 | Buffer.concat([rando, rando], 8)
28 | tap.ok(false);
29 | } catch (e) {
30 | tap.ok(e);
31 | }
32 |
33 | try {
34 | Buffer.concat()
35 | } catch (e) {
36 | tap.ok(e);
37 | }
38 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-239.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(4);
4 |
5 | try {
6 | // Invalid use: not an array
7 | Buffer.concat(new Buffer([1, 2, 3]), 'hey', new Buffer([4, 5, 6]))
8 | } catch (e) {
9 | tap.ok(e instanceof TypeError);
10 | tap.ok(e.message && e.message.indexOf('Usage') > -1);
11 | }
12 |
13 | try {
14 | // Invalid use: no method .copy
15 | Buffer.concat([new Buffer([1, 2, 3]), 'hey', new Buffer([4, 5, 6])])
16 | } catch (e) {
17 | tap.ok(String(e).indexOf('copy') > -1);
18 | }
19 |
20 | try {
21 | Buffer.concat([new Buffer([1, 2, 3]), new Buffer('hey'), new Buffer([4, 5, 6])])
22 | tap.ok(true, 'correct Buffer.concat usage')
23 | } catch (e) {
24 | tap.ok(false, 'correct Buffer.concat usage')
25 | }
--------------------------------------------------------------------------------
/test/suite/streams.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap')
2 |
3 | tap.count(1);
4 |
5 | var Readable = require('stream').Readable;
6 | var Writable = require('stream').Writable;
7 | var Transform = require('stream').Transform;
8 |
9 | var input = ["1", "2", "3"]
10 |
11 | var A = new Readable();
12 | A._read = function () {
13 | this.push(input.shift());
14 | }
15 |
16 | var B = new Transform();
17 | B._transform = function (chunk, encoding, callback) {
18 | this.push(chunk);
19 | setImmediate(callback);
20 | }
21 |
22 | var C = new Writable();
23 | C._write = function (chunk, encoding, callback) {
24 | console.log('#', chunk);
25 | callback();
26 | }
27 |
28 | A.pipe(B).pipe(C).on('finish', function () {
29 | tap.ok(true, 'stream piping ended with end event')
30 | });
31 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.x509_1024.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIB1zCCAUACCQCrCBinAwcn/TANBgkqhkiG9w0BAQUFADA0MTIwMAYDVQQKEylh
3 | eFRMUyBQcm9qZWN0IERvZGd5IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xMDEy
4 | MjYyMjMzMzlaFw0yNDA5MDMyMjMzMzlaMCwxFjAUBgNVBAoTDWF4VExTIFByb2pl
5 | Y3QxEjAQBgNVBAMTCTEyNy4wLjAuMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
6 | gYEAzf2JSL42uZV21BMwDr+y7WcKwBY/UQmdKS+ybT8+bC+QgKFx3744xcupmkAU
7 | kAr5twcL4drnCb8NV0GGYKHBJ5FbCphGG/aihPhlx84tlheqkfhhBFBw67RDt9ya
8 | zDEBFNTNzMI3bWmC1sbEvvI0pcmmGVMyeoYOkYIPoUJUqgECAwEAATANBgkqhkiG
9 | 9w0BAQUFAAOBgQBAtJSaqIlyHQfls2uIIcI4Np56jElIaAwG6NsfTgXmMeP95g1r
10 | 2BMX4C0NuH7LIGyoc6f946f68wJgeB8TQEXudfUQ/Y9odNSsrgQJVSzb2AcHZWkn
11 | br9eYUBWi9czO/9uU36dP8BAOqugUE6AR0YNHttM8RtdPCpUp036e3JmxQ==
12 | -----END CERTIFICATE-----
13 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.x509_1042.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIB2TCCAUICCQCrCBinAwcn/jANBgkqhkiG9w0BAQUFADA0MTIwMAYDVQQKEylh
3 | eFRMUyBQcm9qZWN0IERvZGd5IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xMDEy
4 | MjYyMjMzNDBaFw0yNDA5MDMyMjMzNDBaMCwxFjAUBgNVBAoTDWF4VExTIFByb2pl
5 | Y3QxEjAQBgNVBAMTCTEyNy4wLjAuMTCBoTANBgkqhkiG9w0BAQEFAAOBjwAwgYsC
6 | gYMDUYXtMubODhuyrWhYD7fomF6ZQMdjvQSYQIEEzdP0NsZq6a3wM1k6dMB1hmMs
7 | GbT5jNfen3JdhL2s8AQ4rio6HJD3RCegOKr9Rt2r62MvWFSMflc6X4bH+bFxsnIV
8 | jW6D+FLSeVPeVxpB0BVIQv2qSFNrTDlYbKU/RtGDx+TfgM354QIDAQABMA0GCSqG
9 | SIb3DQEBBQUAA4GBAIEoXdKa4a2ThBYfcfAO8CCwnU4qUKOpAut3k3XSRdwOnQrG
10 | epJ3UP1OpoMeoN2gtagcjcTzhXv/QPYbx5lRko5QfERFJwpNthy+Z8pa11JNY1dX
11 | YugRs4Ad1BoKrCBYnm/QE7ZKVPEGFt2b/geFAW8HpndNWzn2PnTcdDQ/tC2X
12 | -----END CERTIFICATE-----
13 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_sql2.lua:
--------------------------------------------------------------------------------
1 | require"postgres"
2 |
3 | local env = assert (luasql.postgres ())
4 | local conn = assert (env:connect ("luasql-test", "tomas"))
5 | local cur = assert (conn:execute ("select count(*) from t1"))
6 | local total = tonumber (cur:fetch())
7 | cur:close()
8 | local aleatorio = math.random(total)
9 | local cur = assert (conn:execute ("select * from t1, t2 where b = d and a != "..2*aleatorio))
10 |
11 | cgilua.htmlheader()
12 | cgilua.put ("Aleatorio = "..aleatorio.."
\n")
13 |
14 | local a,b,c,d = cur:fetch()
15 | cgilua.put ("\n")
16 | while a do
17 | -- cgilua.put ("| ",a," | ",b," | ",c," | ",d," |
")
18 | a,b,c,d = cur:fetch()
19 | end
20 | cgilua.put ("
\n")
21 |
22 | cur:close()
23 | conn:close()
24 | env:close()
25 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-179.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(2);
4 |
5 | var util = require('util');
6 | var events = require('events');
7 |
8 | function Test(name) {
9 | this.name = name;
10 | }
11 |
12 | util.inherits(Test, events.EventEmitter);
13 |
14 | var t = new Test("t");
15 |
16 | t.once('booted', bootSequence.bind(t));
17 |
18 | var c = new Test("c");
19 |
20 | c.once('booted', bootSequence.bind(c));
21 |
22 | function bootSequence(data) {
23 | setImmediate(function() {
24 | tap.ok(data, this.name);
25 | }.bind(this));
26 | }
27 |
28 | t.emit('booted', true);
29 |
30 | c.emit('booted', true);
31 |
32 | console.log('# no more not oks');
33 |
34 | t.emit('booted', false);
35 |
36 | c.emit('booted', false);
37 |
38 | t.emit('booted', false);
--------------------------------------------------------------------------------
/test/suite/parse-numbers.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(13);
4 |
5 | var s = '10';
6 | tap.ok(parseInt(s,10) == 10);
7 | tap.ok(parseFloat(s,10) == 10);
8 | console.log("# base 10:", parseInt(s,10));
9 | tap.ok(parseInt(s,16) == 16);
10 | tap.ok(parseFloat(s,16) == 10);
11 | console.log("# base 16:", parseInt(s,16));
12 | tap.ok(parseInt(s,2) == 2);
13 | tap.ok(parseFloat(s,2) == 10);
14 | console.log("# base 2:", parseInt(s,2));
15 |
16 | tap.ok(parseInt('0399') == 399, 'octal int');
17 | tap.ok(parseFloat('0399') == 399, 'octal float');
18 |
19 | // stress test invalid radixes
20 | tap.ok(parseInt(s,0) == 10, 'radix 0');
21 | tap.ok(isNaN(parseInt(s,37)));
22 | tap.ok(isNaN(parseInt(s,1)));
23 | tap.ok(isNaN(parseInt(s,"1")));
24 | tap.ok(!isNaN(parseFloat(s,0)));
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.ca_x509.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIB3zCCAUgCCQD76Ccq3Co3qjANBgkqhkiG9w0BAQUFADA0MTIwMAYDVQQKEylh
3 | eFRMUyBQcm9qZWN0IERvZGd5IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xMDEy
4 | MjYyMjMzMzdaFw0yNDA5MDMyMjMzMzdaMDQxMjAwBgNVBAoTKWF4VExTIFByb2pl
5 | Y3QgRG9kZ3kgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
6 | A4GNADCBiQKBgQCfxX6VHEhZNsMIqPPxt53h1UpfX1jU7ctqwBR4dpWRj3H6cCBN
7 | EK8xj7IVcBTJq6vcMRDwrAUrElSIZl8Kv6+ZqhTss2j+E2tfzkzehP9LcAdAR+UM
8 | JPBsYXic/+vmH5JCMO7CXLUsDJmO2q2Z1TjTtchu2DgAueTo0hWRtMvbMwIDAQAB
9 | MA0GCSqGSIb3DQEBBQUAA4GBABoJU0aQMTocVLNbcY4tbfqLck2oAn/OVjG0p/8p
10 | GIJzlVKOtZ76ZkqHIbcXNKNlgjXy+4S3R+6+mkYcn0JVbVg7eN0tsDlMB04YyFaD
11 | 95D47KEzmDky4Yj2nqI4SmvVTf2lyYxV1zknrFUXND+WvjGxge3gpJxtMoTGE5E0
12 | Jc3F
13 | -----END CERTIFICATE-----
14 |
--------------------------------------------------------------------------------
/test/suite/with.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(7);
4 |
5 | var internal = function () {
6 | return 'external';
7 | }
8 |
9 | var external = function () {
10 | return 'external';
11 | }
12 |
13 | var obj = {
14 | internal: function () {
15 | return 'internal';
16 | }
17 | }
18 |
19 | var a = 5;
20 | with (obj) {
21 | tap.eq(internal(), 'internal')
22 | tap.eq(external(), 'external');
23 | obj.external = function () {
24 | return 'internal';
25 | }
26 | tap.eq(external(), 'internal');
27 | a = 6;
28 | }
29 | tap.eq(a, 6);
30 |
31 | t = 5;
32 | var a, x, y;
33 | var r = 10;
34 |
35 | with (Math) {
36 | a = PI * r * r;
37 | x = r * cos(PI);
38 | y = r * sin(PI / 2);
39 | }
40 |
41 | tap.eq(a, Math.PI * 100)
42 | tap.eq(x, -10)
43 | tap.eq(y, 10)
44 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_variables.lp:
--------------------------------------------------------------------------------
1 |
2 | <% for _, var in pairs { "SERVER_SOFTWARE", "SERVER_NAME", "GATEWAY_INTERFACE", "SERVER_PROTOCOL", "SERVER_PORT", "REQUEST_METHOD", "PATH_INFO", "PATH_TRANSLATED", "SCRIPT_NAME", "QUERY_STRING", "REMOTE_HOST", "REMOTE_ADDR", "AUTH_TYPE", "REMOTE_USER", "REMOTE_IDENT", "CONTENT_TYPE", "CONTENT_LENGTH", "HTTP_REFERER", "HTTP_COOKIE", "SCRIPT_FILENAME", "DOCUMENT_ROOT", } do %>
3 | | <%= var %> | = | "<%= cgilua.servervariable(var) or "not defined"%>" |
4 | <% end %>
5 |
6 |
7 |
8 |
9 | <% for _, var in ipairs { "script_file", "script_path", "script_pdir", "script_vdir", "script_vpath", "urlpath", } do %>
10 | | <%= var %> | = | "<%= cgilua[var] %>" |
11 | <% end %>
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/config/colony.gyp:
--------------------------------------------------------------------------------
1 | {
2 | "includes": [
3 | "common.gypi",
4 | ],
5 |
6 | "targets": [
7 | {
8 | "target_name": "colony",
9 | "product_name": "colony",
10 | "type": "executable",
11 | 'cflags': [ '-Wall', '-Wextra', '-Werror' ],
12 | "sources": [
13 | '<(runtime_path)/colony/cli.c',
14 | ],
15 | 'xcode_settings': {
16 | 'OTHER_LDFLAGS': [
17 | '-pagezero_size', '10000', '-image_base', '100000000'
18 | ],
19 | },
20 | "include_dirs": [
21 | '<(runtime_path)/',
22 | '<(runtime_path)/colony/',
23 | "<(colony_lua_path)/src",
24 | ],
25 | "dependencies": [
26 | 'libcolony.gyp:libcolony',
27 | 'libtm.gyp:libtm',
28 | ],
29 | }
30 | ]
31 | }
32 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/ms_iis.cer:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIB5jCCAVOgAwIBAgIQWPe7KyA+U7lLUohulwW2HDAJBgUrDgMCHQUAMCExHzAd
3 | BgNVBAMTFmF4dGxzLmNlcm9jY2x1Yi5jb20uYXUwHhcNMDgwMzE3MTAyMTA2WhcN
4 | MDkwMzE3MTAyMTA2WjAhMR8wHQYDVQQDExZheHRscy5jZXJvY2NsdWIuY29tLmF1
5 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9JqHlQjrQMt3JW8yxcGhFagDa
6 | D4QiIY8+KItTt13fIBt5g1AG4VXniaylSqKKYNPwVzqSWl7WhxMmoFU73veF8o4M
7 | G0Zc5qbVB6ukrSV4WaTgHrIO6pWkyiaQ4L/eYfCo/2pByhl0IUKkf/TMN346/rFg
8 | JgrElx01l6QHNQrzVQIDAQABoycwJTATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNV
9 | HQ8EBwMFALAAAAAwCQYFKw4DAh0FAAOBgQAbH94H1fryngROJ//Oa0D3vvTO8CJ3
10 | 8VW+3gQEwrPBOWmN6RV8OM0dE6pf8wD3s7PTCcM5+/HI1Qk53nUGrNiOmKM1s0JB
11 | bvsO9RT+UF8mtdbo/n30M0MHMWPCC76baW3R+ANBp/V/z4l1ytpUTt+MHvz0VlUs
12 | J4uJA3s3uh23Tg==
13 | -----END CERTIFICATE-----
14 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-394.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(5);
4 |
5 | var a = {};
6 |
7 | Object.defineProperty(a, 'hello', {
8 | value: 'hi'
9 | })
10 |
11 | tap.eq(a.hello, 'hi');
12 |
13 | try {
14 | Object.defineProperty(null, 'hello', {
15 | value: 'hi'
16 | })
17 | tap.ok(false);
18 | } catch (e) {
19 | tap.ok(true);
20 | }
21 |
22 | try {
23 | Object.defineProperty('', 'hello', {
24 | value: 'hi'
25 | })
26 | tap.ok(false);
27 | } catch (e) {
28 | tap.ok(e);
29 | }
30 |
31 | try {
32 | Object.defineProperty(0, 'hello', {
33 | value: 'hi'
34 | })
35 | tap.ok(false);
36 | } catch (e) {
37 | tap.ok(e);
38 | }
39 |
40 | try {
41 | Object.defineProperty(true, 'hello', {
42 | value: 'hi'
43 | })
44 | tap.ok(false);
45 | } catch (e) {
46 | tap.ok(e);
47 | }
48 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-73.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(1);
4 |
5 | !function(){function n(n){function e(){for(;i=ap;){var u=a++,e=c[u],o=t.call(e,1);o.push(l(u)),++p,e[0].apply(null,o)}}function l(n){return function(u,t){--p,null==s&&(null!=u?(s=u,a=d=0/0,o()):(c[n]=t,--d?i||e():o()))}}function o(){null!=s?m(s):f?m(s,c):m.apply(null,[s].concat(c))}var r,i,f,c=[],a=0,p=0,d=0,s=null,m=u;return n||(n=1/0),r={defer:function(){return s||(c.push(arguments),++d,e()),r},await:function(n){return m=n,f=!1,d||o(),r},awaitAll:function(n){return m=n,f=!0,d||o(),r}}}function u(){}var t=[].slice;n.version="1.0.7","function"==typeof define&&define.amd?define(function(){return n}):"object"==typeof module&&module.exports?module.exports=n:this.queue=n}();
6 |
7 | tap.ok(true, 'loaded minified code.');
8 |
--------------------------------------------------------------------------------
/test/suite/hash.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap')
2 |
3 | tap.count(1)
4 |
5 | var a = { hi: "hi", heya: "there", hellos: "amigos", hitheres: "goodbye" }
6 |
7 | console.log('... nullifying values')
8 |
9 | a.hellos = null
10 | a.hi = null
11 |
12 | console.log('... setting new values')
13 |
14 | a.abcdefghij = "pear"
15 | a.abcdefghijkl = "cob"
16 |
17 | console.log('... should output some undefined values:')
18 | for (var key in a) {
19 | console.log(key, '=>', a[key])
20 | }
21 |
22 | console.log();
23 |
24 |
25 | console.log('... array test');
26 | var b = [1, 2, 3, 4, 5]
27 | console.log(b.length, '==5');
28 | b[4] = null
29 | console.log(b.length, '==5');
30 | b[2] = null
31 | console.log(b.length, '==5');
32 | b[20] = 5
33 | console.log(b.length, '==21');
34 |
35 | tap.ok(true, 'hash test passed without error');
36 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/env.lua:
--------------------------------------------------------------------------------
1 | -- This file should be executed before any script in this directory
2 | -- according to the configuration (cgilua/conf.lua).
3 |
4 | pcall (cgilua.enablesession)
5 |
6 | local put, mkurlpath = cgilua.put, cgilua.mkurlpath
7 |
8 | cgilua.addclosefunction (function ()
9 | put [[
10 |
11 |
12 | Main]]
13 | for _, test in {
14 | { "Get", "test_main.lua", {ab = "cd", ef = "gh"} },
15 | { "Cookies", "test_cookies.lua", },
16 | { "FileSystem", "test_fs.lua", },
17 | { "Libraries", "test_lib.lua", },
18 | { "Session", "test_session.lua", },
19 | { "Variables", "test_variables.lp", },
20 | } do
21 | put (string.format (' · %s',
22 | mkurlpath (test[2], test[3]), test[1]))
23 | end
24 | put [[
25 | ]]
26 | end)
27 |
--------------------------------------------------------------------------------
/test/suite/etters.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(8);
4 |
5 | var a = {}
6 | a.hello = 'A'
7 | tap.ok(a.hello == 'A', 'normal property getter')
8 | Object.defineProperties(a, {
9 | 'hello': {
10 | get: function () {
11 | return 'B';
12 | }
13 | }
14 | });
15 | a.__defineSetter__('hello', function (val) {
16 | tap.ok(true, 'called setter');
17 | });
18 | tap.ok(a.hello == 'B', 'getter defined');
19 | a.hello = 'C'
20 | tap.ok(a.hello == 'B', 'setter worked');
21 |
22 | var b = {};
23 | b.hello = 'A';
24 | tap.ok(b.hello == 'A', 'normal property getter');
25 | b.__defineSetter__('hello', function (val) {
26 | tap.ok(true, 'setter without getter worked')
27 | });
28 | tap.ok(b.hello == null, 'setter removed value #TODO')
29 | b.hello = 'B';
30 | tap.ok(b.hello != 'B', 'setter didnt change value')
--------------------------------------------------------------------------------
/test/issues/issue-beta-212.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(8);
4 |
5 | var n = 42;
6 | tap.ok(n.toString(10) == '42')
7 | console.log("# base 10:", JSON.stringify(n.toString(10)));
8 | tap.ok(n.toString(16) == '2a')
9 | console.log("# base 16:", JSON.stringify(n.toString(16)));
10 | tap.ok(n.toString(2) == '101010')
11 | console.log("# base 2:", JSON.stringify(n.toString(2)));
12 | tap.ok(n.toString(24) == '1i')
13 | console.log("# base 24:", JSON.stringify(n.toString(24)));
14 |
15 | console.log()
16 |
17 | // stress test invalid radixes
18 | try { n.toString(1); tap.ok(false); }
19 | catch (e) { tap.ok(e); }
20 | try { n.toString(0); tap.ok(false); }
21 | catch (e) { tap.ok(e); }
22 | try { n.toString(37); tap.ok(false); }
23 | catch (e) { tap.ok(e); }
24 | try { n.toString("1"); tap.ok(false); }
25 | catch (e) { tap.ok(e); }
--------------------------------------------------------------------------------
/test/issues/issue-runtime-303.js:
--------------------------------------------------------------------------------
1 | // A JS error should be thrown on invalid Objects.
2 |
3 | var tap = require('../tap')
4 |
5 | tap.count(9)
6 |
7 | function test (source, isobject) {
8 | console.log('');
9 | try {
10 | Object.keys(source);
11 | if (isobject) {
12 | tap.ok(true, 'no error on object')
13 | } else {
14 | tap.ok(false, 'error not generated for non-object');
15 | }
16 | } catch (e) {
17 | if (isobject) {
18 | tap.ok(false, 'error generated on object');
19 | tap.ok(false, 'error generated on object');
20 | } else {
21 | tap.ok(e instanceof Error);
22 | tap.ok(e instanceof TypeError);
23 | console.log('#', e.message)
24 | }
25 | }
26 | }
27 |
28 | test(5, false);
29 | test('', false);
30 | test({}, true);
31 | test(null, false);
32 | test(true, false);
33 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-302.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | var tests = [
4 | [function fn() { return ref; }, 'Function', 'function'],
5 | [Buffer([1,2,3]), 'Object', 'object'],
6 | [new Date(), 'Date', 'object'],
7 | [/abc/g, 'RegExp', 'object'],
8 | [new Error('baaaa'), 'Error', 'object'],
9 | [void 0, 'Undefined', 'undefined'],
10 | [true, 'Boolean', 'boolean'],
11 | // [null, 'Null', 'object'],
12 | ['a', 'String', 'string'],
13 | [42, 'Number', 'number'],
14 | [[], 'Array', 'object'],
15 | [(function () { return arguments; })(), 'Arguments', 'object']
16 | ];
17 |
18 | tap.count(tests.length * 2);
19 |
20 | tests.forEach(function (d) {
21 | console.log('#', d[0])
22 | tap.eq(Object.prototype.toString.call(d[0]), '[object ' + d[1] + ']', 'Object.prototype.toString');
23 | tap.eq(typeof d[0], d[2], 'typeof');
24 | });
25 |
--------------------------------------------------------------------------------
/deps/fatfs/src/integer.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------*/
2 | /* Integer type definitions for FatFs module */
3 | /*-------------------------------------------*/
4 |
5 | #ifndef _FF_INTEGER
6 | #define _FF_INTEGER
7 |
8 | #ifdef _WIN32 /* FatFs development platform */
9 |
10 | #include
11 | #include
12 |
13 | #else /* Embedded platform */
14 |
15 | /* This type MUST be 8 bit */
16 | typedef unsigned char BYTE;
17 |
18 | /* These types MUST be 16 bit */
19 | typedef short SHORT;
20 | typedef unsigned short WORD;
21 | typedef unsigned short WCHAR;
22 |
23 | /* These types MUST be 16 bit or 32 bit */
24 | typedef int INT;
25 | typedef unsigned int UINT;
26 |
27 | /* These types MUST be 32 bit */
28 | typedef long LONG;
29 | typedef unsigned long DWORD;
30 |
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "deps/hsregex"]
2 | path = deps/hsregex
3 | url = https://github.com/tessel/hsregex.git
4 | [submodule "deps/http-parser"]
5 | path = deps/http-parser
6 | url = https://github.com/joyent/http-parser.git
7 | [submodule "deps/lua-5.1"]
8 | path = deps/colony-lua
9 | url = https://github.com/tessel/colony-lua.git
10 | [submodule "deps/c-ares"]
11 | path = deps/c-ares
12 | url = https://github.com/tessel/c-ares.git
13 | [submodule "deps/fortuna"]
14 | path = deps/fortuna
15 | url = https://github.com/waitman/libfortuna.git
16 | [submodule "deps/miniz"]
17 | path = deps/miniz
18 | url = https://github.com/tessel/miniz
19 | [submodule "deps/rapidjson"]
20 | path = deps/rapidjson
21 | url = https://github.com/miloyip/rapidjson.git
22 | [submodule "deps/colony-luajit"]
23 | path = deps/colony-luajit
24 | url = https://github.com/tcr/luajit.git
25 |
--------------------------------------------------------------------------------
/test/suite/truthy.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(16);
4 |
5 | tap.ok(!(0) == true, '0 is falsy');
6 | tap.ok(!(false) == true, 'false is falsy');
7 | tap.ok(!(undefined) == true, 'undefined is falsy')
8 | tap.ok(!(null) == true, 'null is falsy')
9 | tap.ok(!('') == true, '"" is falsy');
10 | tap.ok(!!([]) == true, '[] is truthy');
11 | tap.ok(!!("0") == true, '\"0\" is truthy');
12 | tap.ok(!!({}) == true, '{} is truthy');
13 |
14 | var a;
15 | a = 0; tap.ok(!(a) == true, '0 is falsy');
16 | a = false; tap.ok(!(a) == true, 'false is falsy');
17 | a = undefined; tap.ok(!(a) == true, 'undefined is falsy')
18 | a = null; tap.ok(!(a) == true, 'null is falsy')
19 | a = ''; tap.ok(!(a) == true, '"" is falsy');
20 | a = []; tap.ok(!!(a) == true, '[] is truthy');
21 | a = "0"; tap.ok(!!(a) == true, '\"0\" is truthy');
22 | a = {}; tap.ok(!!(a) == true, '{} is truthy');
23 |
--------------------------------------------------------------------------------
/src/colony/lua_http_parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 The Luvit Authors. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 |
18 | #ifndef LHTTP_PARSER
19 | #define LHTTP_PARSER
20 |
21 | #include "lua.h"
22 | #include "lauxlib.h"
23 |
24 | LUALIB_API int luaopen_http_parser (lua_State *L);
25 |
26 | #endif
--------------------------------------------------------------------------------
/test/net/http-md5.js:
--------------------------------------------------------------------------------
1 | // TLS module
2 | if (!require('crypto')._tls) {
3 | var tap = require('../tap');
4 | tap.count(1);
5 | tap.ok(false, 'crypto not enabled #SKIP');
6 | process.exit(0);
7 | }
8 |
9 | var tap = require('../tap');
10 |
11 | tap.count(2);
12 |
13 | var http = require('http');
14 | var crypto = require('crypto');
15 |
16 | http.get("http://tessel-httpbin.herokuapp.com/status/418", function (res) {
17 | tap.eq(typeof res.statusCode, 'number', 'statuscode is a number');
18 | console.log('# statusCode', res.statusCode)
19 |
20 | var hash = crypto.createHash('md5');
21 | res.pipe(hash);
22 |
23 | hash.on('readable', function () {
24 | var md5 = hash.read().toString('hex');
25 | console.log('#', md5);
26 | tap.eq(md5, 'a039239a1eae504e41cb810c98419b99', 'teapot md5 works');
27 | })
28 | }).on('error', function (e) {
29 | tap.ok(false, String(e));
30 | });
31 |
--------------------------------------------------------------------------------
/deps/luabitop-1.0/nsievebits.lua:
--------------------------------------------------------------------------------
1 | -- This is the (naive) Sieve of Eratosthenes. Public domain.
2 |
3 | local bit = require("bit")
4 | local band, bxor, rshift, rol = bit.band, bit.bxor, bit.rshift, bit.rol
5 |
6 | local function nsieve(p, m)
7 | local count = 0
8 | for i=0,rshift(m, 5) do p[i] = -1 end
9 | for i=2,m do
10 | if band(rshift(p[rshift(i, 5)], i), 1) ~= 0 then
11 | count = count + 1
12 | for j=i+i,m,i do
13 | local jx = rshift(j, 5)
14 | p[jx] = band(p[jx], rol(-2, j))
15 | end
16 | end
17 | end
18 | return count
19 | end
20 |
21 | if arg and arg[1] then
22 | local N = tonumber(arg[1]) or 1
23 | if N < 2 then N = 2 end
24 | local primes = {}
25 |
26 | for i=0,2 do
27 | local m = (2^(N-i))*10000
28 | io.write(string.format("Primes up to %8d %8d\n", m, nsieve(primes, m)))
29 | end
30 | else
31 | assert(nsieve({}, 10000) == 1229)
32 | end
33 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-306.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(11);
4 |
5 | tap.ok((new Buffer([-1]))[0] == 0xff, 'wrap: -1 == 0xff');
6 | tap.ok((new Buffer([0x555 % 0xFF]))[0] == 0x5a, 'wrap: 0x555 % 0xFF == 0x5a');
7 |
8 | tap.ok((new Buffer([256]))[0] == 0x00, 'wrap: 256 == 0');
9 | tap.ok((new Buffer([-256]))[0] == 0x00, 'wrap: -256 == 0');
10 | tap.ok((new Buffer([0x555]))[0] == 0x55, 'wrap: 0x555 == 0x55');
11 | tap.ok((new Buffer([300]))[0] == 0x2c, 'wrap: 300 == 0x2c');
12 | tap.ok((new Buffer([-300]))[0] == 0xd4, 'wrap: -300 == 0xd4');
13 | tap.ok((new Buffer([-0x555]))[0] == 0xab, 'wrap: -0x555 == 0xab');
14 |
15 | var a = 0x555, b = 0xFF
16 | tap.ok((-a) % b == -90, 'modulus check: -0x555 % 0xFF == -90');
17 | tap.ok((new Buffer([(-0x555) % 0xff]))[0] == 0xa6, 'wrap: -0x555 % 0xff == 0xa6');
18 |
19 | var b = new Buffer(1);
20 | b.writeInt8(-1, 0);
21 | tap.ok(b[0] == 0xff, 'writing -1 yields 0');
--------------------------------------------------------------------------------
/test/suite/bind.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(4);
4 |
5 | var util = require('util');
6 | var EventEmitter = require('events').EventEmitter;
7 |
8 | function UART(){}
9 | util.inherits(UART, EventEmitter);
10 |
11 | var globalUART = new UART();
12 | function Test() {
13 | this.uart = globalUART;
14 | this.uart.on('data', this.parseIncoming.bind(this));
15 | }
16 |
17 | var i = 1;
18 | Test.prototype.parseIncoming = function(data, _, _, _, _, c) {
19 | tap.ok(data == i, 'test ' + i + ' bound arguments correctly');
20 | console.log('#', arguments)
21 | i++
22 | if (i == 4) {
23 | tap.ok(c != null, 'last numerical value included');
24 | }
25 | }
26 |
27 | var test = new Test();
28 | setTimeout(function() {
29 | globalUART.emit('data', 1)
30 | globalUART.emit('data', 2, 'extra args');
31 | globalUART.emit('data', 3, 'extra args', 'more extra args', 1, 2, 3);
32 | }, 0);
--------------------------------------------------------------------------------
/test/suite/hasOwnProperty.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(9);
4 |
5 | var a = {x: 5}
6 | tap.eq(a.hasOwnProperty('x'), true, 'object hasOwnProperty positive')
7 | tap.eq(a.hasOwnProperty('y'), false, 'object hasOwnProperty negative')
8 | tap.eq(a.hasOwnProperty('hasOwnProperty'), false, 'object hasOwnProperty prototype')
9 |
10 | var f = function(){};
11 | f.foo = 1
12 | tap.eq(f.hasOwnProperty('foo'), true, 'function hasOwnProperty positive')
13 | tap.eq(f.hasOwnProperty('bar'), false, 'function hasOwnProperty negative')
14 |
15 | var b = new Buffer(1);
16 | b.foo = 1;
17 | tap.eq(b.hasOwnProperty('foo'), true, 'buffer hasOwnProperty positive')
18 | tap.eq(b.hasOwnProperty('bar'), false, 'buffer hasOwnProperty negative')
19 |
20 | var s = 'string';
21 | tap.eq(s.hasOwnProperty('length'), true, 'string hasOwnProperty positive')
22 | tap.eq(s.hasOwnProperty('bar'), false, 'string hasOwnProperty negative')
23 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "runtime",
3 | "version": "1.0.0",
4 | "private": true,
5 | "bin": {
6 | "colony": "./out/Release/colony",
7 | "colony-compiler": "./node_modules/colony-compiler/bin/colony-compiler.js",
8 | "colony-profile": "./bin/colony-profile.js"
9 | },
10 | "directories": {
11 | "example": "examples",
12 | "test": "test"
13 | },
14 | "scripts": {
15 | "test": "echo 'ERROR: Please use `make test` now.' && echo '' && exit 1",
16 | "install": "true"
17 | },
18 | "dependencies": {
19 | "async": "~0.2.9",
20 | "bindings": "~1.2.0",
21 | "colony-compiler": "~0.6.23",
22 | "mkdirp": "~0.3.5",
23 | "semver": "^4.1.0"
24 | },
25 | "devDependencies": {
26 | "nodejs-websocket": "^1.0.0",
27 | "faye-websocket": "~0.7.2",
28 | "tap": "git+https://github.com/tcr/node-tap.git#4f96b1",
29 | "tape": "~2.3.2",
30 | "tinytap": "^0.2.0"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_conc.lua:
--------------------------------------------------------------------------------
1 | cgilua.htmlheader()
2 | if ap then
3 | local pid, ppid = ap.pid ()
4 | if not ppid then
5 | ppid = "no parent pid"
6 | end
7 | cgilua.put ("pid = "..pid.." ("..ppid..")".."\n")
8 | end
9 |
10 | assert(type(stable.get) == "function")
11 | assert(type(stable.set) == "function")
12 |
13 | cgilua.put"stable.pairs = {
\n"
14 | for i, v in stable.pairs () do
15 | cgilua.put (i.." = "..tostring(v).."
\n")
16 | end
17 | cgilua.put"}
\n"
18 |
19 | local counter = stable.get"counter" or 0
20 | stable.set ("counter", counter + 1)
21 |
22 | local f = stable.get"f"
23 | if not f then
24 | local d = os.date()
25 | stable.set ("f", function () return d end)
26 | else
27 | cgilua.put ("f() = "..tostring (f ()))
28 | end
29 |
30 | cgilua.put"
\n"
31 | for i = 1,800 do
32 | cgilua.put (i)
33 | for ii = 1,1000 do
34 | cgilua.put ("")
35 | end
36 | cgilua.put ("\n")
37 | end
38 | cgilua.put ("End")
39 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_lib.lua:
--------------------------------------------------------------------------------
1 | local function getfield (t, f)
2 | for w in string.gfind(f, "[%w_]+") do
3 | if not t then return nil end
4 | t = t[w]
5 | end
6 | return t
7 | end
8 |
9 | function test_lib (libname)
10 | local ok, err = pcall (require, libname)
11 | if not ok then
12 | cgilua.put ("Library "..libname.." not found
\n"..
13 | err)
14 | else
15 | cgilua.put ("Library "..libname.."
\n")
16 | local t = getfield (_G, libname)
17 | if type(t) ~= "table" then
18 | cgilua.put (tostring(t))
19 | else
20 | for i, v in pairs (t) do
21 | cgilua.put (" "..tostring(i).." = "..tostring(v).."
\n")
22 | end
23 | end
24 | end
25 | cgilua.put ("\n\n")
26 | end
27 |
28 | cgilua.htmlheader ()
29 | for _, lib in ipairs { "lfs", "socket", "luasql.postgres", "luasql", "lxp", "lxp.lom", "lualdap", "htk", "xmlrpc", "xmlrpc.http" } do
30 | test_lib (lib)
31 | end
32 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.x509_2048.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICWzCCAcQCCQCrCBinAwcn/zANBgkqhkiG9w0BAQQFADA0MTIwMAYDVQQKEylh
3 | eFRMUyBQcm9qZWN0IERvZGd5IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xMDEy
4 | MjYyMjMzNDBaFw0yNDA5MDMyMjMzNDBaMCwxFjAUBgNVBAoTDWF4VExTIFByb2pl
5 | Y3QxEjAQBgNVBAMTCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
6 | AQoCggEBAKWgulghnDyduQE0oEn5PgUqoW/gnHB8D83dumyQU+KaNUQhmkcX16w6
7 | jZt/1IQaqJd5dGyGt/zR6r9pZt54DNXrCZ8JgVk58gToqaUhNNoRIeUiYj/scqP3
8 | pZiBYjVPM+jl1RirIttS191JoiqFhr4OdkOkPEwV1FLyh7s3v9OHAoS8m3U3cbD4
9 | 5tZUwLEFSgEKsBMYUrE03i6RjwHK1sNGbJ1Jwv6eWlGLqYnlGI1TgoZrx5SeZ/2R
10 | ii1jXKv2TiKLrSuSe+WlwebSK2u8/sRiQ8F6FZI2vVt2S6FjHLgZPijjusxb6XRl
11 | v+AsfmR6k3xnmKRVgqIvvl4PMlUWiy0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQAY
12 | uw++Zz6+68dQvmd9MiHeYZxVsajDJ0RVEiV9V/TFLsGmJXmtHHX0vVjZJSpDomWJ
13 | WKPZu/HvR6KrtOtz+HM2ap5FFfPcg5LA2Dqau2tvTub1KdvDSbfaTqRsh1cQ8FQI
14 | 222gV/DG5AZ8AlSuDzTgrMuIeWjKZ6hhkirZVIO+rg==
15 | -----END CERTIFICATE-----
16 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.ca_key.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICXQIBAAKBgQCfxX6VHEhZNsMIqPPxt53h1UpfX1jU7ctqwBR4dpWRj3H6cCBN
3 | EK8xj7IVcBTJq6vcMRDwrAUrElSIZl8Kv6+ZqhTss2j+E2tfzkzehP9LcAdAR+UM
4 | JPBsYXic/+vmH5JCMO7CXLUsDJmO2q2Z1TjTtchu2DgAueTo0hWRtMvbMwIDAQAB
5 | AoGARYOF+ZZenAJJhSENUiPTm4hTXX98hNgZYw7DWU4u8S/6JT5Xr3AM6YFduBoV
6 | 0VDR63GlrzEI5p6JDPeNbn3MBl14ZNZVOOkzenxsCsymCHKhickxR8VlRoN26Xpb
7 | OcMxsnEOJ8zh0F97Re8bsE7OQhk4Z7KtArby2jY1bpSqkRECQQDQ0D9lIq0oINaS
8 | Uezmj/eSlmRjUwF+Vx8t16Yu8mD8CJZUVBEhDn/Xo2GWlkFgbWUoAPanr8zAwKJX
9 | 6gImgMVPAkEAw+AxIgMqxs0GmsiesQMPe3Rf5kRId7ApFdhCq15J4URGOTdnyIUj
10 | LBzJpGSiQFb/Fkt5dGrsDzawFd7hlBCa3QJAcWJCqiX0JDAAkx8NJfzSj7Q9+njd
11 | /L5N3dSVFjTiWLhI+K1VR7/ZxzueB+i6wyNjpB8xz8fzxE5VWKtmU4XknQJBAKW+
12 | K/UK1wR3cnJA9j70RwKA27D98JAOaQWKBAf79en+mqlJn7EGL1fhWCKZ4M0ukBSu
13 | cqw22V6aOO+YtCpUzqUCQQCapy9lw3tDuCAljW8H3p9ce/+wuK1FTnF0TCalgHQp
14 | kn4btRLmj0josAj4lRrzi2uaYfwq39h9OIuy7ES7YKcv
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.device_key.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICXAIBAAKBgQDH2LDa/QrOXOLHsqLCayRYs74qlWlk9yLTtIJVxumBJNo40TwG
3 | 8g+Sq6LhtZBAD7tZaM9XjgIi1iFjc1eKALFaEKpzT5pS9HM0mK48bgwO4DV0gbvC
4 | t1LlwfEC1EkXgoMDumZwF0bpoKldLK9ayp6sXOYe7dcBc8CVjOiqzVCDowIDAQAB
5 | AoGAZ2ap0xS8I5wRxouaBQgUrUSK71ORTalFPs6V5TXfGW/s7RrteRaDkjr2MtyT
6 | f2HkaNV++mlCl629ZsyGDaRgHjPI6skemqbwws4l+QMglXkLQ2ST6xuMqrNlCaKN
7 | Ys0l291VftlS6Bi/C/LD3bwMf6HTGThufchmQ87OvXYtNQkCQQD1jC5jypbk+Ilc
8 | X4aGXaOSsyzrf3QblhPFTsXTIHwV56JNap5D1405LUeH9XvAca+EZyYAg0N/pOXB
9 | rkSXww3PAkEA0Fp8+/zDI00liFOEud2hQ0A/VCqg0+SyCVGvA7AFnuXEURPbMkSB
10 | ktk/x4BBn5DZUJMfOOal/ewbgPNqbClV7QJAPMw31EeeMxWC1VdltLFMxg8NSUYm
11 | looDXTBS9SKu9rGC005Z34xokEaw1m4m9RBxGAR+OVRHCzzmEp22qCkIqwJAWSDM
12 | ZHMs+rXuv1GS7nuLl5wtOxD9OYeUTX4+0uIClYWOpGxNEUTS9QGwUeRgriSlgd1d
13 | ttab3XKaFWCLfvdzxQJBANuWeyBMYnNDBi3j++/NmmKEg9Reiby0dT3wSPe6oJKf
14 | ux9foG8SpLGGnHuJQerD1IkACP+GuaGxWUxsVzPxtns=
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.key_1024.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICXQIBAAKBgQDN/YlIvja5lXbUEzAOv7LtZwrAFj9RCZ0pL7JtPz5sL5CAoXHf
3 | vjjFy6maQBSQCvm3Bwvh2ucJvw1XQYZgocEnkVsKmEYb9qKE+GXHzi2WF6qR+GEE
4 | UHDrtEO33JrMMQEU1M3MwjdtaYLWxsS+8jSlyaYZUzJ6hg6Rgg+hQlSqAQIDAQAB
5 | AoGBAJWqbhH1aouixkjGfDdrH1UQdiYkw/JcWt0u86QevHscgBCFvNhFPLiyBlO1
6 | 1XrnDpLmQsLiKtXRA59vU3Roco6/A7urvaH5gX0S1J22rkytyqjJgI0N1dChv+xg
7 | SEntlw9e7fw5FZaeXeK0XS4E3AiiZSktN/tikBt75TpYBVXBAkEA/GkoyajEXOPQ
8 | Xqra3od028tAeI4dEpYWYT+zPqMN3EmlJYfFl4Wdu7TwRP1s6NKM7DOBRh4QEjMW
9 | lQBPdbTleQJBANDrZQcQO9kD69xvS4/Dh8521sUUIU7nTxvoBfiEGuDF1uMIs1RX
10 | Ah/U2fv/QLFWHGD3rJHz08Z/hP2Eneom7skCQQCmzxxsgQMcXFYFaiZw79YTt3Qo
11 | 98pQ0S2DIWTk3T84uNbSQbMcmuoN9drfzRefmh4Vr0gcvZtjW63t1KGuqVkJAkBO
12 | CM6oj8C684MCyDNiFHfCf5MC89zpGu7qjoTEaZucf2kfTh2lkAZEG338aUAhvPdG
13 | pNw5e+iLSRBEnWdakYY5AkBBLE7+2ZCJAFyUCkp+GxqABgE32lBhnZz+JX/Y1MSe
14 | gfIMHjghHpA/1LpsU8vwd3mb8fo/gdzzIQJtt5XDLs7V
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/src/colony/modules/console.js:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
2 | // file at the top-level directory of this distribution.
3 | //
4 | // Licensed under the Apache License, Version 2.0 or the MIT license
6 | // , at your
7 | // option. This file may not be copied, modified, or distributed
8 | // except according to those terms.
9 |
10 | var util = require('util'),
11 | _log = process.binding('tm').log;
12 |
13 | exports.log = function () {
14 | _log(10, util.format.apply(util, arguments));
15 | }
16 | exports.info = function () {
17 | _log(11, util.format.apply(util, arguments));
18 | }
19 | exports.warn = function () {
20 | _log(12, util.format.apply(util, arguments));
21 | }
22 | exports.error = function () {
23 | _log(13, util.format.apply(util, arguments));
24 | }
25 | exports.trace = function () {
26 | // no-op
27 | }
28 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.key_1042.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIICZwIBAAKBgwNRhe0y5s4OG7KtaFgPt+iYXplAx2O9BJhAgQTN0/Q2xmrprfAz
3 | WTp0wHWGYywZtPmM196fcl2EvazwBDiuKjockPdEJ6A4qv1G3avrYy9YVIx+Vzpf
4 | hsf5sXGychWNboP4UtJ5U95XGkHQFUhC/apIU2tMOVhspT9G0YPH5N+AzfnhAgMB
5 | AAECgYMBqUlbwxTK6UMygx9unofaOJV7MXPgWZs4QWqVphlK9DUHBu9eBcbQvewv
6 | qdRyGniASeMz/yy45qAyOIJUgdR//RU9oaW/J+HZOM4LJRqP12BPmSjujuVd10h4
7 | xRmEt3xCW5JwEIcBWhrMqhlU0QoiX/kT+tv5esBeCglE0yeynOqjtQJCAfUa/zZV
8 | ReqIEH7NaYWHMZ6NOhS35gB15Ka8JDR9avQFJVq0D2NpF1ysohGqorvB0Z19IhHW
9 | 9HfYZ4kBOAf856pDAkIBsf8PJGBnBema7096ZLFmykGaTiECDOJH52wLlqnWVr/W
10 | UmlNzC/Dh+WFDwxH5csW7iLciLkNwhFTLltOMEw7owsCQgHOjbgNIFOkdSq80cHY
11 | 5v2PfI+jdklSHYENw9eruCWU0Hc1rcYSnnxZKGWF5zvGEtf6Bvr++qu5QMH5fm2J
12 | OhNiXwJCANlis/f5ncEVaTjzq4/iWGV5BMybtgY0FeYydX+LJMShJL505rYfOqbI
13 | baTC9wSAfMTdi2+kmeKagPrYW0rP9JNPAkEwMQ3d0gOzgT6nxG1BCTXOABZKg4Gl
14 | Q7OOtmo+ZZEyjE8q/jfs5YsQi2TTFCpwwgS++LqrFAuXHzJZC3X4hrUNuw==
15 | -----END RSA PRIVATE KEY-----
16 |
--------------------------------------------------------------------------------
/test/suite/url.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(14);
4 |
5 | var expected = { protocol: 'ws:',
6 | slashes: true,
7 | auth: 'user:pass',
8 | host: 'somedomain.com:1234',
9 | port: '1234',
10 | hostname: 'somedomain.com',
11 | hash: '#hash1',
12 | search: '?q=123',
13 | query: 'q=123',
14 | pathname: '/events',
15 | path: '/events?q=123',
16 | href: 'ws://user:pass@somedomain.com:1234/events?q=123#hash1' };
17 |
18 | var url = require('url');
19 | tap.ok(url.parse('http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04#section-6'), 'url parses');
20 |
21 | var actual = url.parse('ws://user:pass@somedomain.com:1234/events?q=123#hash1');
22 |
23 | Object.keys(expected).forEach(function(k){
24 | tap.eq(actual[k], expected[k], k + ' should matched expected ')
25 | });
26 |
27 | tap.ok(url.parse('http://api.openweathermap.org/data/2.5/weather?id=5327684&units=imperial').hostname == 'api.openweathermap.org', 'hostname match');
28 |
--------------------------------------------------------------------------------
/test/issues/issue-beta-81.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(2);
4 |
5 | var actions = ["a", "b", "c", "d", "e", "f", "g"];
6 | var _n = 1;
7 | tap.ok(actions[_n] == 'b', 'underscores in member properties not undefined');
8 | var _j = {_k: 5}
9 | tap.ok(actions[_j._k] == 'f', 'underscores in member properties in member properties not undefined');
10 |
11 | // var actions = ["a", "b", "c", "d", "e", "f", "g"];
12 | // for (_n in actions) {
13 | // console.log("_n", _n);
14 | // console.log("actions[_n]", actions[_n]);
15 | // }
16 | // for (n in actions) {
17 | // console.log("n", n);
18 | // console.log("actions[n]", actions[n]);
19 | // }
20 | // var _i, _len;
21 | // for (_i = 0, _len = actions.length; _i < _len; _i++) {
22 | // console.log("_i", _i);
23 | // console.log("actions[_i]", actions[_i]);
24 | // }
25 | // var i, len;
26 | // for (i = 0, len = actions.length; i < len; i++) {
27 | // console.log("i", i);
28 | // console.log("actions[i]", actions[i]);
29 | // }
--------------------------------------------------------------------------------
/test/suite/timers.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(4);
4 |
5 | var source = setTimeout(function () {
6 | // TODO this test differs between Node and browser.
7 | // tap.ok(this == source, '"this" value in timer is timer return value');
8 | tap.ok(true, 'setTimeout is called');
9 | }, 10);
10 |
11 | var id = setInterval(function () {
12 | tap.ok(false, 'error, interval was not cancelled');
13 | process.exit(1);
14 | }, 100)
15 | clearInterval(id);
16 |
17 | console.log('# timeout id:', id)
18 |
19 | var count = 0;
20 | var jk = setInterval(function () {
21 | count++;
22 | clearInterval(jk);
23 | if (count > 1) {
24 | tap.ok(false, 'error, interval was not cancelled from inside interval')
25 | process.exit(1)
26 | }
27 | }, 0)
28 |
29 | setImmediate(function (arg1, arg2, arg3) {
30 | tap.ok(arg1 != null, 'args passed into callback');
31 | tap.ok(arg2 == null, 'null args allowed in callback');
32 | tap.ok(arg3 != null, 'null args allowed in callback');
33 | }, 5, null, 6)
--------------------------------------------------------------------------------
/deps/axtls/config/axtls.rc:
--------------------------------------------------------------------------------
1 | //Microsoft Visual C++ generated resource script.
2 | //
3 | #define APSTUDIO_READONLY_SYMBOLS
4 | /////////////////////////////////////////////////////////////////////////////
5 | //
6 | // Generated from the TEXTINCLUDE 2 resource.
7 | //
8 | #define APSTUDIO_HIDDEN_SYMBOLS
9 | #undef APSTUDIO_HIDDEN_SYMBOLS
10 | /////////////////////////////////////////////////////////////////////////////
11 | #undef APSTUDIO_READONLY_SYMBOLS
12 |
13 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
14 | LANGUAGE 9, 1
15 | #pragma code_page(1252)
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | //
19 | // Icon
20 | //
21 |
22 | // Icon with lowest ID value placed first to ensure application icon
23 | // remains consistent on all systems.
24 |
25 | IDI_AXTLS ICON "../www/favicon.ico"
26 |
27 |
28 | #endif
29 | /////////////////////////////////////////////////////////////////////////////
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/deps/luabitop-1.0/msvcbuild.bat:
--------------------------------------------------------------------------------
1 | @rem Script to build Lua BitOp with MSVC.
2 |
3 | @rem First change the paths to your Lua installation below.
4 | @rem Then open a "Visual Studio .NET Command Prompt", cd to this directory
5 | @rem and run this script. Afterwards copy the resulting bit.dll to
6 | @rem the directory where lua.exe is installed.
7 |
8 | @if not defined INCLUDE goto :FAIL
9 |
10 | @setlocal
11 | @rem Path to the Lua includes and the library file for the Lua DLL:
12 | @set LUA_INC=-I ..
13 | @set LUA_LIB=..\lua51.lib
14 |
15 | @set MYCOMPILE=cl /nologo /MD /O2 /W3 /c %LUA_INC%
16 | @set MYLINK=link /nologo
17 | @set MYMT=mt /nologo
18 |
19 | %MYCOMPILE% bit.c
20 | %MYLINK% /DLL /export:luaopen_bit /out:bit.dll bit.obj %LUA_LIB%
21 | if exist bit.dll.manifest^
22 | %MYMT% -manifest bit.dll.manifest -outputresource:bit.dll;2
23 |
24 | del *.obj *.exp *.manifest
25 |
26 | @goto :END
27 | :FAIL
28 | @echo You must open a "Visual Studio .NET Command Prompt" to run this script
29 | :END
30 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/verisign.x509_ca.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICmDCCAgECECCol67bggLewTagTia9h3MwDQYJKoZIhvcNAQECBQAwgYwxCzAJ
3 | BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEwMC4GA1UECxMnRm9y
4 | IFRlc3QgUHVycG9zZXMgT25seS4gIE5vIGFzc3VyYW5jZXMuMTIwMAYDVQQDEylW
5 | ZXJpU2lnbiBUcmlhbCBTZWN1cmUgU2VydmVyIFRlc3QgUm9vdCBDQTAeFw0wNTAy
6 | MDkwMDAwMDBaFw0yNTAyMDgyMzU5NTlaMIGMMQswCQYDVQQGEwJVUzEXMBUGA1UE
7 | ChMOVmVyaVNpZ24sIEluYy4xMDAuBgNVBAsTJ0ZvciBUZXN0IFB1cnBvc2VzIE9u
8 | bHkuICBObyBhc3N1cmFuY2VzLjEyMDAGA1UEAxMpVmVyaVNpZ24gVHJpYWwgU2Vj
9 | dXJlIFNlcnZlciBUZXN0IFJvb3QgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
10 | AoGBAJ8h98U7klaZH5cEn6CSEKmGWVBsTwHIaMAAVqGqCUn7Q9C10sEOIHBznyLy
11 | eSDjMs5M1nC/iAA7KCASf/yHz0AdlU+1IRSijwHTF/2dYSoTTxP2GCmtL1Ga4i7+
12 | zDDo086V7+NiFAGJj+CYey47ue4Xa33o/4YOA9PGL87oqFe7AgMBAAEwDQYJKoZI
13 | hvcNAQECBQADgYEAOq447rP5EDqFEl3vhLhgTbnyaskNYwPvxk+0grnQyDA4sF/q
14 | gK8nFlnvLmAOF3DmfuqW6WSr4zqTYzpwmJlsn48Om/yWirL8GuWRftit2POxTfHS
15 | B8VmR+PZx2k24UgWUZyojDGxJtiHd3tjCdqFgTit4NK429cWOcZrh47xeOI=
16 | -----END CERTIFICATE-----
17 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/cert.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICsDCCAhmgAwIBAgIJAIoxoOAgS75iMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
3 | BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
4 | aWRnaXRzIFB0eSBMdGQwHhcNMTEwNjI0MTE1NjExWhcNMTEwNzI0MTE1NjExWjBF
5 | MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
6 | ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
7 | gQCczEspLfQhmZ6ZdBDNCwvZR4C3Nn7KTnF/u+mU7f5k5E+z4930b4u6+gm24/uk
8 | XVF0Lf++IMrf/mjQDPFYU2LHCdtza/jUaUnjyln5VixPPDT6mS6zpgwg9ylAN1Us
9 | PumJkz21Z1NrXZm8BuoOHTYRrbG3lW7KDRi9/KJQPo56VwIDAQABo4GnMIGkMB0G
10 | A1UdDgQWBBQNb4zqgrkasyqy/JIajFF04Nbw/TB1BgNVHSMEbjBsgBQNb4zqgrka
11 | syqy/JIajFF04Nbw/aFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt
12 | U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAIoxoOAg
13 | S75iMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAhe4Gbo/SzwDHM3V7
14 | C0tDnfQjc6yvDtkTdSG6HbL24lJpjCcsaQh5Bgtkq4YnfjwhXuKD2oeBuqSm90o9
15 | uWXpCqPinE43xbfVDBSUe3IvChDyVFzqVVri2QnBhMWGNQFuodIHCtxTbSa0qX8t
16 | FuWK8ULggrqrVR91fuZsyOyncBw=
17 | -----END CERTIFICATE-----
18 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-448.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(8);
4 |
5 | var testString = "This is a Test String";
6 | var buffer = new Buffer(testString);
7 | tap.eq(buffer.toString(), testString, "default encoding doesn't return utf-8 encoded string.");
8 | tap.eq(buffer.toString('utf8'), testString, "utf-8 encoding doesn't return the correct string.");
9 | tap.eq(buffer.toString('utf8', 5, 7), testString.slice(5, 7), "Offset arguments not returning correct string");
10 | tap.eq(buffer.toString('utf8', -5, -5), '', "Negative offset arguments return empty string");
11 | tap.eq(buffer.toString('utf8', -5, 5), testString.slice(0, 5), "Negative start offset defaults to start offset of 0");
12 | tap.eq(buffer.toString('utf8', 0, 1000), testString, "End offset larger then buffer defaults to end of buffer");
13 | tap.eq(buffer.toString('utf8', 5, 1000), testString.slice(5), "End offset larger then buffer defaults to end of buffer while origin offset still slices");
14 |
15 | var fakeEncoding = 'fake';
16 | try {
17 | buffer.toString('fake');
18 | }
19 | catch(e) {
20 | tap.eq(e.name, "TypeError", "Error thrown on invalid encoding.");
21 | }
22 |
--------------------------------------------------------------------------------
/deps/axtls/binding.gyp:
--------------------------------------------------------------------------------
1 | {
2 | 'targets': [
3 | {
4 | 'target_name': 'liblibaxtls',
5 | 'type': 'static_library',
6 | 'sources': [
7 | 'crypto/aes.c',
8 | 'crypto/bigint.c',
9 | 'crypto/crypto_misc.c',
10 | 'crypto/hmac.c',
11 | 'crypto/md2.c',
12 | 'crypto/md5.c',
13 | 'crypto/rc4.c',
14 | 'crypto/rsa.c',
15 | 'crypto/sha1.c',
16 |
17 | 'ssl/asn1.c',
18 | 'ssl/gen_cert.c',
19 | 'ssl/loader.c',
20 | 'ssl/openssl.c',
21 | 'ssl/os_port.c',
22 | 'ssl/p12.c',
23 | 'ssl/tls1.c',
24 | 'ssl/tls1_svr.c',
25 | 'ssl/tls1_clnt.c',
26 | 'ssl/x509.c'
27 | ],
28 | 'include_dirs': [
29 | 'ssl',
30 | 'crypto',
31 | 'config'
32 | ],
33 | 'direct_dependent_settings': {
34 | 'include_dirs': [
35 | 'ssl',
36 | 'crypto',
37 | 'config'
38 | ]
39 | }
40 | },
41 | {
42 | 'target_name': 'axssl',
43 | 'type': 'executable',
44 | 'dependencies': [
45 | 'liblibaxtls'
46 | ],
47 | 'sources': [
48 | 'samples/c/axssl.c'
49 | ]
50 | }
51 | ]
52 | }
53 |
--------------------------------------------------------------------------------
/src/posix/tm_timestamp.c:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
2 | // file at the top-level directory of this distribution.
3 | //
4 | // Licensed under the Apache License, Version 2.0 or the MIT license
6 | // , at your
7 | // option. This file may not be copied, modified, or distributed
8 | // except according to those terms.
9 |
10 | #include "tm.h"
11 | #include "../colony/colony.h"
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | #include
19 |
20 |
21 |
22 | /**
23 | * timestamp
24 | */
25 |
26 |
27 | // returns microseconds
28 |
29 | double tm_timestamp ()
30 | {
31 | struct timeval tv;
32 | gettimeofday(&tv, NULL);
33 |
34 | double time_in_mill = (((double) tv.tv_sec) * 1000) + (((double) tv.tv_usec) / 1000);
35 | return (double) (time_in_mill * 1000);
36 | }
37 |
38 | int tm_timestamp_update (double millis)
39 | {
40 | fprintf(stderr, "ERROR: tm_timestamp_update does not work on this platform.\n");
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013-2014 Technical Machine, Inc
2 |
3 | Permission is hereby granted, free of charge, to any
4 | person obtaining a copy of this software and associated
5 | documentation files (the "Software"), to deal in the
6 | Software without restriction, including without
7 | limitation the rights to use, copy, modify, merge,
8 | publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software
10 | is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice
14 | shall be included in all copies or substantial portions
15 | of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 | DEALINGS IN THE SOFTWARE.
26 |
--------------------------------------------------------------------------------
/examples/bench/json-parse.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | var json2 = require('./json2');
3 |
4 | var count = 5;
5 | var data = fs.readFileSync(__dirname + '/json-parse-test.json', 'utf-8');
6 | var minsize = 100000; // not including whitespace, unicode issues
7 |
8 | var start1 = process.hrtime();
9 | for (var i = 0; i < count; i++) {
10 | var attempt = JSON.parse(data);
11 | var out = JSON.stringify(attempt);
12 | if (out.length < minsize) {
13 | throw new Error('Invalid parsing by internal JSON parser');
14 | }
15 | }
16 | var end1 = process.hrtime();
17 |
18 |
19 | var start2 = process.hrtime();
20 | for (var i = 0; i < count; i++) {
21 | var attempt = json2.parse(data);
22 | var out = json2.stringify(attempt);
23 | if (out.length < minsize) {
24 | throw new Error('Invalid parsing by JSON.js');
25 | }
26 | }
27 | var end2 = process.hrtime();
28 |
29 | var trial1 = (((end1[0]*1e9+end1[1]) - (start1[0]*1e9+start1[1])) / count)/1e9;
30 | var trial2 = (((end2[0]*1e9+end2[1]) - (start2[0]*1e9+start2[1])) / count)/1e9;
31 |
32 | console.log('Internal:\t', trial1.toFixed(3), 'seconds per iteration')
33 | console.log('JSON.js:\t', trial2.toFixed(3), 'seconds per iteration')
34 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-304.js:
--------------------------------------------------------------------------------
1 | // Tests throw/catch/finally blocks with return statements.
2 |
3 | var tap = require('../tap');
4 |
5 | tap.count(3);
6 |
7 | function test (dothrow) {
8 | var a = [];
9 |
10 | function fn () {
11 | try {
12 | a.push('try');
13 | if (dothrow) {
14 | throw up;
15 | } else {
16 | return 'try';
17 | }
18 | } catch (e) {
19 | a.push('catch');
20 | return 'catch';
21 | } finally {
22 | a.push('finally');
23 | }
24 | a.push('function');
25 | return 'function';
26 | }
27 |
28 | var ret = fn();
29 | a.push('->', ret);
30 | return a.join(' ');
31 | }
32 |
33 | tap.eq(test(false), 'try finally -> try');
34 | tap.eq(test(true), 'try catch finally -> catch');
35 |
36 | // This is an edge case for colony-compiler where try{} and catch{}
37 | // blocks are actually evaluated closures. Before 0.6.16, try blocks can
38 | // "return null" and actually continue with execution(!)
39 |
40 | var ret = (function () {
41 | try {
42 | return null
43 | } catch (e) { }
44 | tap.ok(false);
45 | return true;
46 | })();
47 | if (ret == null) {
48 | tap.ok(true);
49 | }
50 |
--------------------------------------------------------------------------------
/test/suite/math.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(16);
4 |
5 | // number encoding
6 | tap.ok(0644 == 420, 'octal encoding');
7 |
8 | // variables
9 | tap.ok(Math.E == 2.718281828459045, 'Math.E')
10 | tap.ok(Math.LN2 == 0.6931471805599453, 'Math.LN2')
11 | tap.ok(Math.LN10 == 2.302585092994046, 'Math.LN10')
12 | tap.ok(Math.LOG2E == 1.4426950408889634, 'Math.LOG2E')
13 | tap.ok(Math.LOG10E == 0.4342944819032518, 'Math.LOG10E')
14 | tap.ok(Math.PI == 3.141592653589793, 'Math.PI')
15 | tap.ok(Math.SQRT1_2 == 0.7071067811865476, 'Math.SQRT1_2')
16 | tap.ok(Math.SQRT2 == 1.4142135623730951, 'Math.SQRT2')
17 |
18 | // round
19 | tap.ok(Math.round(20.49) == 20, 'Math.round(20.49)')
20 | tap.ok(Math.round(20.5) == 21, 'Math.round(20.5)')
21 | tap.ok(Math.round(-20.5) == -20, 'Math.round(-20.5)')
22 | tap.ok(Math.round(-20.51) == -21, 'Math.round(-20.51)')
23 | // Note the rounding error because of inaccurate floating point arithmetics
24 | tap.ok((Math.round(1.005*100)/100) == 1, 'Math.round(1.005*100)/100');
25 |
26 | // etc
27 | tap.ok(Math.pow(2, 2) == 4, 'Math.pow')
28 |
29 | // nan
30 | console.log('#', String(0/0))
31 | tap.ok(String(0/0) == 'NaN', 'NaN is NaN and not nan');
32 |
--------------------------------------------------------------------------------
/src/colony/modules/dns.js:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
2 | // file at the top-level directory of this distribution.
3 | //
4 | // Licensed under the Apache License, Version 2.0 or the MIT license
6 | // , at your
7 | // option. This file may not be copied, modified, or distributed
8 | // except according to those terms.
9 | var tm = process.binding('tm');
10 |
11 | exports.resolve = function (domain, type, callback) {
12 | if (typeof type == 'function') {
13 | callback = type;
14 | type = null
15 | };
16 |
17 | // TODO use type
18 |
19 | var tries = 3;
20 | setImmediate(function poll () {
21 | // CC3000 can flake with cares. Three time's the charm.
22 | var ipl = tm._sync_gethostbyname(domain);
23 | if (ipl == 0) {
24 | tries--;
25 | if (tries > 0) {
26 | return poll();
27 | }
28 | callback(new Error('ENOENT'));
29 | } else {
30 | callback(null, [[(ipl >> 24) & 0xFF, (ipl >> 16) & 0xFF, (ipl >> 8) & 0xFF, (ipl >> 0) & 0xFF].join('.')])
31 | }
32 | });
33 | }
34 |
35 | // TODO the rest!
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_session.lua:
--------------------------------------------------------------------------------
1 | cgilua.enablesession ()
2 |
3 | function pt (tab)
4 | for i, v in pairs (tab) do
5 | local vv = v
6 | if type(v) == "table" then
7 | vv = ""
8 | for _i, _v in pairs (v) do
9 | vv = vv..string.format ("%s = %q, ", _i, _v)
10 | end
11 | vv = '{'..vv..'}'
12 | end
13 | cgilua.put (string.format ("%s = %s
\n", tostring (i), tostring (vv)))
14 | end
15 | end
16 |
17 |
18 | if cgi.field then
19 | if not cgilua.session.data.field then
20 | cgilua.session.data.field = {}
21 | end
22 | table.insert (cgilua.session.data.field, cgi.field)
23 | end
24 | cgilua.htmlheader()
25 | if cgilua.session then
26 | cgilua.put "cgi = {
\n"
27 | pt (cgi)
28 | cgilua.put "}
\n"
29 | cgilua.put "cgilua.session.data = {
\n"
30 | pt (cgilua.session.data)
31 | cgilua.put "}
\n"
32 |
33 | cgilua.put [[]]
41 | else
42 | cgilua.put "Sessions library is not available or not well configured"
43 | end
44 |
--------------------------------------------------------------------------------
/deps/fatfs/doc/img/app1.c:
--------------------------------------------------------------------------------
1 | /*------------------------------------------------------------/
2 | / Open or create a file in append mode
3 | /------------------------------------------------------------*/
4 |
5 | FRESULT open_append (
6 | FIL* fp, /* [OUT] File object to create */
7 | const char* path /* [IN] File name to be opened */
8 | )
9 | {
10 | FRESULT fr;
11 |
12 | /* Opens an existing file. If not exist, creates a new file. */
13 | fr = f_open(fp, path, FA_WRITE | FA_OPEN_ALWAYS);
14 | if (fr == FR_OK) {
15 | /* Seek to end of the file to append data */
16 | fr = f_lseek(fp, f_size(fp));
17 | if (fr != FR_OK)
18 | f_close(fp);
19 | }
20 | return fr;
21 | }
22 |
23 |
24 | int main (void)
25 | {
26 | FRESULT fr;
27 | FATFS fs;
28 | FIL fil;
29 |
30 | /* Open or create a log file and ready to append */
31 | f_mount(&fs, "", 0);
32 | fr = open_append(&fil, "logfile.txt");
33 | if (fr != FR_OK) return 1;
34 |
35 | /* Append a line */
36 | f_printf(&fil, "%02u/%02u/%u, %2u:%02u\n", Mday, Mon, Year, Hour, Min);
37 |
38 | /* Close the file */
39 | f_close(&fil);
40 |
41 | return 0;
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-373.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(6);
4 |
5 | var fruits = ["Banana", "Orange", "Apple", "Mango", "Cherry"];
6 | fruits.splice(0, 4);
7 | tap.eq(fruits.toString(), 'Cherry', 'splice is correct w/ deleting at 0');
8 |
9 | var fruits = ["Banana", "Orange", "Apple", "Mango", "Cherry"];
10 | fruits.splice(0, 4, 'Pear');
11 | tap.eq(fruits.toString(), 'Pear,Cherry', 'splice is correct w/ deleting and inserting at 0');
12 |
13 | var fruits = ["Banana", "Orange", "Apple", "Mango", "Cherry"];
14 | fruits.splice(0, 0, 'Pear');
15 | tap.eq(fruits.toString(), 'Pear,Banana,Orange,Apple,Mango,Cherry', 'splice is correct w/ inserting at 0');
16 |
17 | var fruits = ["Banana", "Orange", "Apple", "Mango", "Cherry"];
18 | fruits.splice(1, 4);
19 | tap.eq(fruits.toString(), 'Banana', 'splice is correct w/ deleting at 1');
20 |
21 | var fruits = ["Banana", "Orange", "Apple", "Mango", "Cherry"];
22 | fruits.splice(1, 4, 'Pear');
23 | tap.eq(fruits.toString(), 'Banana,Pear', 'splice is correct w/ deleting and inserting at 1');
24 |
25 | var fruits = ["Banana", "Orange", "Apple", "Mango", "Cherry"];
26 | fruits.splice(1, 0, 'Pear');
27 | tap.eq(fruits.toString(), 'Banana,Pear,Orange,Apple,Mango,Cherry', 'splice is correct w/ inserting at 1');
28 |
--------------------------------------------------------------------------------
/deps/node-libs/constants.js:
--------------------------------------------------------------------------------
1 | // Copyright Joyent, Inc. and other Node contributors.
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the
5 | // "Software"), to deal in the Software without restriction, including
6 | // without limitation the rights to use, copy, modify, merge, publish,
7 | // distribute, sublicense, and/or sell copies of the Software, and to permit
8 | // persons to whom the Software is furnished to do so, subject to the
9 | // following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 | // USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
22 | module.exports = process.binding('constants');
23 |
--------------------------------------------------------------------------------
/test/suite/bug-underscores.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(9);
4 |
5 | _typeof = function () { tap.ok(false, 'typeof overwritten'); }
6 | typeof 5;
7 |
8 | var dlow = 6;
9 | dlow = 5;
10 | tap.ok(dlow != 6, 'simple variable scoping');
11 |
12 | var d_high;
13 | d__high = 6;
14 | (function () {
15 | var d_high;
16 | d__high = 5;
17 | })();
18 | tap.ok(d__high == 5, 'var decl underscores are escaped properly');
19 |
20 | var a_b = 'hi';
21 | tap.ok(a_b == 'hi', 'var underscores');
22 |
23 | a_b += ' there';
24 | tap.ok(a_b == 'hi there', 'var underscores in lvalue of assignment');
25 |
26 | tap.ok(a_b.toUpperCase() == 'HI THERE', 'underscore in lvalue of member expression');
27 |
28 | var c_d = {};
29 | c_d.cool_beans = 5;
30 | tap.ok(c_d['cool_beans'] == 5, 'dynamic property values')
31 |
32 | c_d.func_tastic = function () {
33 | tap.ok(true, 'underscore in member and base')
34 | }
35 | c_d.func__tastic = function () {
36 | tap.ok(false,' underscore in member and base');
37 | }
38 | c_d.func_tastic();
39 |
40 | var actions = ["a", "b", "c", "d", "e", "f", "g"];
41 | var _n = 1;
42 | tap.ok(actions[_n] != undefined, 'underscores in member properties not undefined');
43 | var _j = {_k: 5}
44 | tap.ok(actions[_j._k] != undefined, 'underscores in member properties in member properties not undefined');
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.x509_4096.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDWzCCAsQCCQCrCBinAwcoADANBgkqhkiG9w0BAQQFADA0MTIwMAYDVQQKEylh
3 | eFRMUyBQcm9qZWN0IERvZGd5IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xMDEy
4 | MjYyMjMzNDFaFw0yNDA5MDMyMjMzNDFaMCwxFjAUBgNVBAoTDWF4VExTIFByb2pl
5 | Y3QxEjAQBgNVBAMTCTEyNy4wLjAuMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC
6 | AgoCggIBAKOYAobI/sEAa0jY3Wnh2UBTQbKzLIEF0/PuVOehqtnXZ1T+7LPTuks8
7 | ijWm+OXN/uvLg0YZQDpOtjut7Jog6X3PDr1fnGCZB9ByzUqVDCC3OtY3Vlp8ax0b
8 | x0JuQ65ZHP7PlQn+2DDcmzsymooHXWdajCOb7TXdZCt48fau9fE/1pp4+Z0sKUiu
9 | bld/ihm5IgbmwSbRWrbHzZJ3MavMCHMKwCvCUDMU1s4Vek+DxZta3ApKPB5aQrW9
10 | fupNT01XEJkQBjpO8m8zPrcXQWKU0m2Ylj+7KXobNw+YuFgoZRhJLEdUaGN/RUVU
11 | pjdTZ8A6rCquiOMg1SaVm1pCP4zDk2wYrklfHSM/I9CZxBoixWEmYcVNAxREcm5Q
12 | LmLWhvE8PTL5MoOhkaOAn37NFtzqjfSHoTMMmXzqFjV1tKZJstQ+/vc61IKp5CcK
13 | e6vPZfZH/t7Zx9h/7rgQQmwYfDRbv0GIKwTwFI5hxH9XipPQpS0CvOU/SemhqSVY
14 | 9MdVZtv75Wq7Oagcd00qwvgSoNhVUKEym2zeckkt2ukcllohpLr5H7xRSlk1vXfJ
15 | aXh9Yr1zxr1FWeSzlv9lu6VAFd7RV++i0fj99FnjgWMFUHvfXVExCS+jnD1VzfqW
16 | Hc1arikSZ1C1OaTL3eEDyC0RyPfRwCFWk4onUbaUbJgEegk1UQkBAgMBAAEwDQYJ
17 | KoZIhvcNAQEEBQADgYEAihEFhLAmC2H+wWMajxFOuGnKwIACS2XZiYX24/8wNUbJ
18 | CvE/iTv170ZPnT16Asfrc+PJWdVPU3j72bllHjKHtihgBoSCGceK2rN5I/vgVzm6
19 | EbMBJBZVch8FHLNHqR0GXEtge1k8B4mI6rL3f9ZjmCkYgG9Ii7b8o3s2NT1e4E4=
20 | -----END CERTIFICATE-----
21 |
--------------------------------------------------------------------------------
/tools/compile_certs.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var fs = require('fs');
4 | var exec = require('child_process').exec;
5 | var packageFolder = require('./package-folder');
6 |
7 | var out = process.argv[2];
8 | var pemdir = out + '.pem/';
9 | var derdir = out + '.der/';
10 | var infile = process.argv[4];
11 |
12 | var pem = fs.readFileSync(infile, 'utf-8');
13 | var certs = pem.split(/\n\n/g).filter(function (cert) {
14 | return cert.indexOf('---') > -1;
15 | });
16 |
17 | try {
18 | fs.mkdirSync(pemdir);
19 | } catch (e) { }
20 | try {
21 | fs.mkdirSync(derdir);
22 | } catch (e) { }
23 |
24 | var outfiles = [];
25 | var i = 0;
26 | (function loop () {
27 | var cert = certs[i];
28 |
29 | var incert = pemdir + 'cert-' + i + '.pem';
30 | var outcert = derdir + 'cert-' + i + '.der';
31 | outfiles.push(outcert);
32 |
33 | fs.writeFileSync(incert, cert);
34 | exec('openssl x509 -in ' + incert + ' -inform PEM -out ' + outcert + ' -outform DER', function (code, stdout, stderr) {
35 | if (code) {
36 | console.log(stdout);
37 | console.error(stderr);
38 | process.exit(code);
39 | }
40 | i++;
41 | if (certs.length > i) {
42 | loop();
43 | } else {
44 | packageFolder(outfiles, process.argv[3], function (err, out) {
45 | fs.writeFileSync(process.argv[2], out);
46 | });
47 | }
48 | })
49 | })();
--------------------------------------------------------------------------------
/src/order32.h:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
2 | // file at the top-level directory of this distribution.
3 | //
4 | // Licensed under the Apache License, Version 2.0 or the MIT license
6 | // , at your
7 | // option. This file may not be copied, modified, or distributed
8 | // except according to those terms.
9 |
10 | #ifndef ORDER32_H
11 | #define ORDER32_H
12 |
13 | #include
14 | #include
15 |
16 | #if CHAR_BIT != 8
17 | #error "unsupported char size"
18 | #endif
19 |
20 | enum
21 | {
22 | O32_LITTLE_ENDIAN = 0x03020100ul,
23 | O32_BIG_ENDIAN = 0x00010203ul,
24 | O32_PDP_ENDIAN = 0x01000302ul
25 | };
26 |
27 | static const union { unsigned char bytes[4]; uint32_t value; } o32_host_order =
28 | { { 0, 1, 2, 3 } };
29 |
30 | #define O32_HOST_ORDER (o32_host_order.value)
31 | #define O32_SWAP(x) __builtin_bswap32(x)
32 |
33 | #define O32_HOST_TO_BE(x) ((O32_HOST_ORDER == O32_LITTLE_ENDIAN) ? (O32_SWAP(x)) : (x))
34 | #define O32_HOST_TO_LE(x) ((O32_HOST_ORDER == O32_BIG_ENDIAN) ? (O32_SWAP(x)) : (x))
35 |
36 | #define O32_BE_TO_HOST(x) O32_HOST_TO_BE(x)
37 | #define O32_LE_TO_HOST(x) O32_HOST_TO_LE(x)
38 |
39 |
40 | #endif
--------------------------------------------------------------------------------
/test/colony/floatint.js:
--------------------------------------------------------------------------------
1 | // Tests float v int implementation details of Lua engine.
2 | // Compares 32-bit ints with floats when treated silently
3 | // by underlying engine (as LuaJIT with DUAL_NUM does)
4 |
5 | var tap = require('../tap');
6 |
7 | tap.count(10);
8 |
9 | var tm = process.binding('tm');
10 |
11 | function float_0() {
12 | // Signed-fill right shift generates float
13 | // (as it preserves negative numbers)
14 | var v = 0;
15 | return v >> 0;
16 | };
17 |
18 | function float_1() {
19 | // Signed-fill right shift generates float
20 | // (as it preserves negative numbers)
21 | var v = 1;
22 | return v >> 0;
23 | };
24 |
25 | function int_0(){
26 | return 0;
27 | }
28 |
29 | function int_1(){
30 | return 1;
31 | }
32 |
33 | tap.eq(0, float_0(), 'float 0');
34 | tap.eq(true, !float_0(), 'not float 0');
35 |
36 | tap.eq(1, float_1(), 'float 1');
37 | tap.eq(false, !float_1(), 'not float 1');
38 |
39 | tap.eq(0, int_0(), 'int 0');
40 | tap.eq(true, !int_0(), 'not int 0');
41 |
42 | tap.eq(1, int_1(), 'int 1');
43 | tap.eq(false, !int_1(), 'not int 1');
44 |
45 | if (float_0()) {
46 | tap.ok(false, 'if float 0');
47 | }
48 |
49 | if (float_1()) {
50 | tap.ok(true, 'if float 1');
51 | } v
52 |
53 | if (int_0()) {
54 | tap.ok(false, 'if int 0');
55 | }
56 |
57 | if (int_1()) {
58 | tap.ok(true, 'if int 1');
59 | }
60 |
--------------------------------------------------------------------------------
/test/issues/issue-runtime-287.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap')
2 |
3 | tap.count(15)
4 |
5 | var arr = [1, 2, 3, 1, 2, 3];
6 |
7 | console.log('#', arr.indexOf(2));
8 | tap.eq(arr.indexOf(2), 1);
9 |
10 | console.log('#', arr.indexOf(2, 0));
11 | tap.eq(arr.indexOf(2, 0), 1);
12 |
13 | console.log('#', arr.indexOf(2, 1));
14 | tap.eq(arr.indexOf(2, 1), 1);
15 |
16 | console.log('#', arr.indexOf(2, 2));
17 | tap.eq(arr.indexOf(2, 2), 4);
18 |
19 | console.log('#', arr.indexOf(2, 4));
20 | tap.eq(arr.indexOf(2, 4), 4);
21 |
22 | console.log('#', arr.indexOf(2, 5));
23 | tap.eq(arr.indexOf(2, 5), -1);
24 |
25 | console.log('#', arr.indexOf(3, 5));
26 | tap.eq(arr.indexOf(3, 5), 5);
27 |
28 | console.log('#', arr.indexOf(3, 6));
29 | tap.eq(arr.indexOf(3, 6), -1);
30 |
31 | console.log('#', arr.indexOf(2, 10));
32 | tap.eq(arr.indexOf(2, 10), -1);
33 |
34 | console.log('#', arr.indexOf(2, -1));
35 | tap.eq(arr.indexOf(2, -1), -1);
36 |
37 | console.log('#', arr.indexOf(2, -2));
38 | tap.eq(arr.indexOf(2, -2), 4);
39 |
40 | console.log('#', arr.indexOf(2, -2));
41 | tap.eq(arr.indexOf(2, -2), 4);
42 |
43 | console.log('#', arr.indexOf(2, -4));
44 | tap.eq(arr.indexOf(2, -4), 4);
45 |
46 | console.log('#', arr.indexOf(2, -5));
47 | tap.eq(arr.indexOf(2, -5), 1);
48 |
49 | console.log('#', arr.indexOf(2, -10));
50 | tap.eq(arr.indexOf(2, -10), 1);
51 |
52 |
--------------------------------------------------------------------------------
/deps/axtls/www/lua/test_main.lua:
--------------------------------------------------------------------------------
1 | cgilua.htmlheader()
2 | cgilua.put[[
3 |
4 | Script Lua Test
5 |
6 |
7 | cgi = {
8 | ]]
9 |
10 | for i,v in pairs (cgi) do
11 | if type(v) == "table" then
12 | local vv = "{"
13 | for a,b in pairs(v) do
14 | vv = string.format ("%s%s = %s
\n", vv, a, tostring(b))
15 | end
16 | v = vv.."}"
17 | end
18 | cgilua.put (string.format ("%s = %s
\n", i, tostring(v)))
19 | end
20 | cgilua.put "}
\n"
21 | cgilua.put ("Remote address: "..cgilua.servervariable"REMOTE_ADDR")
22 | cgilua.put "
\n"
23 | cgilua.put ("Is persistent = "..tostring (SAPI.Info.ispersistent).."
\n")
24 | cgilua.put ("ap="..tostring(ap).."
\n")
25 | cgilua.put ("lfcgi="..tostring(lfcgi).."
\n")
26 |
27 | -- Checking Virtual Environment
28 | local my_output = cgilua.put
29 | cgilua.put = nil
30 | local status, err = pcall (function ()
31 | assert (cgilua.put == nil, "cannot change cgilua.put value")
32 | end)
33 | cgilua.put = my_output
34 | assert (status == true, err)
35 |
36 | -- Checking require
37 | local status, err = pcall (function () require"unknown_module" end)
38 | assert (status == false, "unknown_module loaded!")
39 | -- assert (package == nil, "Access to package table allowed!")
40 |
41 | cgilua.put[[
42 |
43 |
44 |
45 | ]]
46 | cgilua = nil
47 |
--------------------------------------------------------------------------------
/deps/node-libs/sys.js:
--------------------------------------------------------------------------------
1 | // Copyright Joyent, Inc. and other Node contributors.
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the
5 | // "Software"), to deal in the Software without restriction, including
6 | // without limitation the rights to use, copy, modify, merge, publish,
7 | // distribute, sublicense, and/or sell copies of the Software, and to permit
8 | // persons to whom the Software is furnished to do so, subject to the
9 | // following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 | // USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
22 | // the sys module was renamed to 'util'.
23 | // this shim remains to keep old programs working.
24 | module.exports = require('util');
25 |
--------------------------------------------------------------------------------
/src/tm_itoa.c:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
2 | // file at the top-level directory of this distribution.
3 | //
4 | // Licensed under the Apache License, Version 2.0 or the MIT license
6 | // , at your
7 | // option. This file may not be copied, modified, or distributed
8 | // except according to those terms.
9 |
10 | #include
11 |
12 | // https://groups.google.com/forum/#!topic/comp.lang.c/IyWWejPrgts
13 |
14 | #define itoa_numorchar(A) ((A) > 9 ? 'a' + ((A) - 10) : '0' + (A))
15 |
16 | char* tm_itoa (long long i, char *s, unsigned int radix)
17 | {
18 | char *p = s;
19 | char *q = s;
20 |
21 | if (i >= 0) {
22 | do {
23 | *q++ = itoa_numorchar(i % radix);
24 | }
25 | while (i /= radix);
26 | } else if (-1 % 2 < 0) {
27 | *q++ = '-';
28 | p++;
29 |
30 | do {
31 | *q++ = itoa_numorchar(i % radix);
32 | } while (i /= radix);
33 | } else {
34 | *q++ = '-';
35 | p++;
36 |
37 | do {
38 | int d = i % radix;
39 | i = i / radix;
40 | if (d) { i++; d = radix - d; }
41 | *q++ = itoa_numorchar(d);
42 | } while (i);
43 | }
44 |
45 | for (*q = 0; p < --q; p++) {
46 | char c = *p;
47 | *p = *q;
48 | *q = c;
49 | }
50 |
51 | return s;
52 | }
--------------------------------------------------------------------------------
/test/issues/issue-beta-334.js:
--------------------------------------------------------------------------------
1 | var tap = require('../tap');
2 |
3 | tap.count(11);
4 |
5 | var buf = new Buffer(4);
6 |
7 | buf.writeUInt32BE(0xdeadbeef, 0);
8 | tap.ok(buf[0] == 0xde, 'UInt32');
9 | tap.ok(buf[1] == 0xad, 'UInt32');
10 | tap.ok(buf[2] == 0xbe, 'UInt32');
11 | tap.ok(buf[3] == 0xef, 'UInt32');
12 | buf.fill(0);
13 |
14 | try {
15 | buf.writeUInt32LE(0xdeadbeef, 2);
16 | tap.ok(false, 'error not thrown by out of bounds write')
17 | } catch (e) {
18 | tap.ok(true, 'error thrown by out of bounds write')
19 | }
20 |
21 | try {
22 | buf.writeUInt32LE(0xdeadbeef, 2, true);
23 | tap.ok(true, 'error not thrown by out of bounds write')
24 | } catch (e) {
25 | tap.ok(false, 'error thrown by out of bounds write')
26 | }
27 | tap.ok(buf[2] == 0xef, 'out of bounds write still writes');
28 | tap.ok(buf[3] == 0xbe, 'out of bounds write still writes');
29 |
30 | try {
31 | buf.readUInt32LE(2);
32 | tap.ok(false, 'error not thrown by out of bounds read')
33 | } catch (e) {
34 | tap.ok(true, 'error thrown by out of bounds write')
35 | }
36 |
37 | buf[0] = 0;
38 | buf[1] = 0;
39 | buf[2] = 0xFF;
40 | buf[3] = 0xFF;
41 | var value = buf.readUInt32LE(0, true);
42 | tap.ok(value == 4294901760, 'in bounds write succeeds')
43 | var value = buf.readUInt32LE(2, true);
44 | tap.ok(isNaN(value) || (value == 65535), 'out of bounds write returns 65535 (older) or NaN (newer) depending on Node version')
--------------------------------------------------------------------------------
/bin/colony-profile.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var fs = require('fs');
4 |
5 | var data = fs.readFileSync('colony.log', 'utf-8');
6 |
7 | var traces = data.match(/(^|\n)stack traceback:[\s\S]+?(\n\n|\s*?$)/g);
8 |
9 | var sections = {
10 | C: {},
11 | T: {},
12 | app: {}
13 | };
14 |
15 | traces.map(function (trace) {
16 | var lines = trace.split(/\t\s*/).slice(2, 3);
17 | lines.forEach(function (line) {
18 | var entries = line.split(/: in ?f?u?n?c?t?i?o?n?\s*/);
19 | var line = (entries[0] + ' in ' + (entries[1] || '?')).replace(/[\n\s]*$/, '').replace(/__/g, '_');
20 | if (!line.match(/[^a-z0-9\/.\[\]A-Z:_$<>\?\'_\- ]/)) {
21 | if (line.match(/^\[T\]/) || line.match(/^builtin\//)) {
22 | var t = sections.T;
23 | } else if (line.match(/^\[C\]/)) {
24 | var t = sections.C;
25 | } else {
26 | var t = sections.app;
27 | }
28 | t[line] || (t[line] = 0);
29 | t[line]++;
30 | }
31 | });
32 | })
33 |
34 | Object.keys(sections).map(function (ticktype) {
35 | var ticks = sections[ticktype];
36 | console.log('functions by tick in section [' + ticktype + ']');
37 | Object.keys(ticks).map(function (key) {
38 | return [key, ticks[key]];
39 | }).sort(function (a, b) {
40 | return a[1] > b[1] ? -1 : a[1] < b[1] ? 1 : 0;
41 | }).reverse().forEach(function (tick) {
42 | console.log((' ' + tick[1]).slice(-8), tick[0]);
43 | });
44 | console.log('');
45 | });
46 |
--------------------------------------------------------------------------------
/deps/axtls/ssl/test/axTLS.x509_device.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIBjTCCATcCCQCrCBinAwcoATANBgkqhkiG9w0BAQUFADAsMRYwFAYDVQQKEw1h
3 | eFRMUyBQcm9qZWN0MRIwEAYDVQQDEwkxMjcuMC4wLjEwHhcNMTAxMjI2MjIzMzQy
4 | WhcNMjQwOTAzMjIzMzQyWjArMSkwJwYDVQQKEyBheFRMUyBQcm9qZWN0IERldmlj
5 | ZSBDZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAx9iw2v0K
6 | zlzix7KiwmskWLO+KpVpZPci07SCVcbpgSTaONE8BvIPkqui4bWQQA+7WWjPV44C
7 | ItYhY3NXigCxWhCqc0+aUvRzNJiuPG4MDuA1dIG7wrdS5cHxAtRJF4KDA7pmcBdG
8 | 6aCpXSyvWsqerFzmHu3XAXPAlYzoqs1Qg6MCAwEAATANBgkqhkiG9w0BAQUFAANB
9 | ALx4Z9moVhA05QsUrMiyy/+NCiFhaOtZfe6kElJoAl4B1EcGQor8ozE3cFuLOLeQ
10 | YuAX5YpbpxuafYbzw1AdAU8=
11 | -----END CERTIFICATE-----
12 | -----BEGIN CERTIFICATE-----
13 | MIIB3zCCAUgCCQD76Ccq3Co3qjANBgkqhkiG9w0BAQUFADA0MTIwMAYDVQQKEylh
14 | eFRMUyBQcm9qZWN0IERvZGd5IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xMDEy
15 | MjYyMjMzMzdaFw0yNDA5MDMyMjMzMzdaMDQxMjAwBgNVBAoTKWF4VExTIFByb2pl
16 | Y3QgRG9kZ3kgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
17 | A4GNADCBiQKBgQCfxX6VHEhZNsMIqPPxt53h1UpfX1jU7ctqwBR4dpWRj3H6cCBN
18 | EK8xj7IVcBTJq6vcMRDwrAUrElSIZl8Kv6+ZqhTss2j+E2tfzkzehP9LcAdAR+UM
19 | JPBsYXic/+vmH5JCMO7CXLUsDJmO2q2Z1TjTtchu2DgAueTo0hWRtMvbMwIDAQAB
20 | MA0GCSqGSIb3DQEBBQUAA4GBABoJU0aQMTocVLNbcY4tbfqLck2oAn/OVjG0p/8p
21 | GIJzlVKOtZ76ZkqHIbcXNKNlgjXy+4S3R+6+mkYcn0JVbVg7eN0tsDlMB04YyFaD
22 | 95D47KEzmDky4Yj2nqI4SmvVTf2lyYxV1zknrFUXND+WvjGxge3gpJxtMoTGE5E0
23 | Jc3F
24 | -----END CERTIFICATE-----
25 |
--------------------------------------------------------------------------------
/deps/luabitop-1.0/Makefile.mingw:
--------------------------------------------------------------------------------
1 | # Makefile for Lua BitOp -- a bit operations library for Lua 5.1/5.2.
2 | # This is a modified Makefile for MinGW. C:\MinGW\bin must be in your PATH.
3 | # Compile: mingw32-make -f Makefile.mingw
4 | # Install: mingw32-make -f Makefile.mingw install
5 |
6 | # Lua executable name. Used for testing.
7 | LUA= lua
8 |
9 | # Include path where lua.h, luaconf.h and lauxlib.h reside:
10 | INCLUDES= "-I.."
11 |
12 | # Path of lua51.dll:
13 | LUADLLPATH= "..\lua51.dll"
14 |
15 | # Path where C modules for Lua should be installed:
16 | LUACMODPATH= ".."
17 |
18 | CC= gcc
19 | CCOPT= -O2 -fomit-frame-pointer
20 | CCWARN = -Wall
21 | SOCC= $(CC) -shared
22 | SOCFLAGS= $(CCOPT) $(CCWARN) $(INCLUDES) $(CFLAGS)
23 | SOLDFLAGS= $(LDFLAGS)
24 | RM= del
25 | STRIP= strip --strip-unneeded
26 | INSTALL= copy
27 |
28 | MODNAME= bit
29 | MODSO= $(MODNAME).dll
30 |
31 | all: $(MODSO)
32 |
33 | $(MODNAME).o: $(MODNAME).c
34 | $(CC) $(SOCFLAGS) -c -o $@ $<
35 |
36 | $(MODSO): $(MODNAME).o
37 | $(SOCC) $(SOLDFLAGS) -o $@ $< $(LUADLLPATH)
38 | $(STRIP) $@
39 |
40 | install: $(MODSO)
41 | $(INSTALL) $< $(LUACMODPATH)
42 |
43 | test: $(MODSO)
44 | @$(LUA) bittest.lua && echo "basic test OK"
45 | @$(LUA) nsievebits.lua && echo "nsievebits test OK"
46 | @$(LUA) md5test.lua && echo "MD5 test OK"
47 |
48 | clean:
49 | $(RM) *.o *.so *.obj *.lib *.exp *.dll *.manifest
50 |
51 | .PHONY: all install test clean
52 |
53 |
--------------------------------------------------------------------------------