spec: TypeArray should work in remote
This commit is contained in:
parent
200d09cc70
commit
eb51e080e5
2 changed files with 18 additions and 5 deletions
|
@ -142,20 +142,25 @@ describe('ipc module', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('remote value in browser', function () {
|
describe('remote value in browser', function () {
|
||||||
var print = path.join(fixtures, 'module', 'print_name.js')
|
const print = path.join(fixtures, 'module', 'print_name.js')
|
||||||
|
const printName = remote.require(print)
|
||||||
|
|
||||||
it('keeps its constructor name for objects', function () {
|
it('keeps its constructor name for objects', function () {
|
||||||
var buf = new Buffer('test')
|
const buf = new Buffer('test')
|
||||||
var printName = remote.require(print)
|
|
||||||
assert.equal(printName.print(buf), 'Buffer')
|
assert.equal(printName.print(buf), 'Buffer')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports instanceof Date', function () {
|
it('supports instanceof Date', function () {
|
||||||
var now = new Date()
|
const now = new Date()
|
||||||
var printName = remote.require(print)
|
|
||||||
assert.equal(printName.print(now), 'Date')
|
assert.equal(printName.print(now), 'Date')
|
||||||
assert.deepEqual(printName.echo(now), now)
|
assert.deepEqual(printName.echo(now), now)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('supports TypedArray', function () {
|
||||||
|
const values = [1, 2, 3, 4]
|
||||||
|
const typedArray = printName.typedArray(values)
|
||||||
|
assert.equal(values.toString(), typedArray.toString())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('remote promise', function () {
|
describe('remote promise', function () {
|
||||||
|
|
8
spec/fixtures/module/print_name.js
vendored
8
spec/fixtures/module/print_name.js
vendored
|
@ -5,3 +5,11 @@ exports.print = function (obj) {
|
||||||
exports.echo = function (obj) {
|
exports.echo = function (obj) {
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.typedArray = function (name) {
|
||||||
|
const int16 = new Int16Array(name.length)
|
||||||
|
for (let i = 0; i < name.length; ++i) {
|
||||||
|
int16[i] = name[i]
|
||||||
|
}
|
||||||
|
return int16
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue