Add support for cloning buffers. [closes #1940]

This commit is contained in:
John-David Dalton
2016-02-04 23:55:55 -08:00
parent fc85cac91d
commit 1595651780
2 changed files with 66 additions and 10 deletions

View File

@@ -44,6 +44,7 @@
amd = root.define && define.amd,
argv = root.process && process.argv,
ArrayBuffer = root.ArrayBuffer,
Buffer = root.Buffer,
defineProperty = Object.defineProperty,
document = !phantom && root.document,
body = root.document && root.document.body,
@@ -2538,6 +2539,22 @@
assert.strictEqual(actual.lastIndex, 3);
});
QUnit.test('`_.' + methodName + '` should clone buffers', function(assert) {
assert.expect(3);
if (Buffer) {
var buffer = new Buffer([1, 2, 3]),
actual = func(buffer);
assert.strictEqual(actual.byteLength, buffer.byteLength);
assert.strictEqual(actual.inspect(), buffer.inspect());
assert.notStrictEqual(actual, buffer);
}
else {
skipTest(assert, 3);
}
});
QUnit.test('`_.' + methodName + '` should clone prototype objects', function(assert) {
assert.expect(2);