From 8698a5e0e81d180f78c0f01be86d8d9e1a5d237e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 19 Feb 2016 08:18:56 -0800 Subject: [PATCH] Add tests for setting the `[[Prototype]]` of clones for values where `constructor` is incorrect. --- test/test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 09607700c..bfd758087 100644 --- a/test/test.js +++ b/test/test.js @@ -2664,12 +2664,20 @@ assert.deepEqual(actual, { 'b': 1 }); }); - QUnit.test('`_.' + methodName + '` should create clone with the same `[[Prototype]]` as `value`', function(assert) { + QUnit.test('`_.' + methodName + '` should set the `[[Prototype]]` of a clone', function(assert) { assert.expect(1); assert.ok(func(new Foo) instanceof Foo); }); + QUnit.test('`_.' + methodName + '` should set the `[[Prototype]]` of a clone even when the `constructor` is incorrect', function(assert) { + assert.expect(1); + + Foo.prototype.constructor = Object; + assert.ok(func(new Foo) instanceof Foo); + Foo.prototype.constructor = Foo; + }); + QUnit.test('`_.' + methodName + '` should ensure `value` constructor is a function before using its `[[Prototype]]`', function(assert) { assert.expect(1);