summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/typedarray/test/server/undef_globals.js
blob: e57dabdcebc9c1f2270c44ae86290925ebf2911e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var test = require('tape');
var vm = require('vm');
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/../../index.js', 'utf8');

test('u8a without globals', function (t) {
    var c = {
        module: { exports: {} },
    };
    c.exports = c.module.exports;
    vm.runInNewContext(src, c);
    var TA = c.module.exports;
    var ua = new(TA.Uint8Array)(5);

    t.equal(ua.length, 5);
    ua[1] = 256 + 55;
    t.equal(ua[1], 55);
    t.end();
});