From 1252d83ebc936293f43a17f5f77981de178fcef6 Mon Sep 17 00:00:00 2001 From: Jannon Date: Mon, 23 Apr 2012 20:22:52 -0700 Subject: [PATCH] A couple more tests of exisiting functions as object keys --- test/cases/contructorproperty.js | 4 ++++ test/cases/memberoftag4.js | 5 +++++ test/runner.js | 1 + test/t/cases/constructorproperty.js | 8 ++++++++ 4 files changed, 18 insertions(+) create mode 100644 test/cases/contructorproperty.js create mode 100644 test/t/cases/constructorproperty.js diff --git a/test/cases/contructorproperty.js b/test/cases/contructorproperty.js new file mode 100644 index 00000000..29ce151b --- /dev/null +++ b/test/cases/contructorproperty.js @@ -0,0 +1,4 @@ +// Simple inheritance model with correct constructor +function Test() {} +function Test2() { Test.call(this); } +Test2.prototype = Object.create(Test.prototype, {constructor: {value: Test2}}); \ No newline at end of file diff --git a/test/cases/memberoftag4.js b/test/cases/memberoftag4.js index 9069d949..baa1c9ff 100644 --- a/test/cases/memberoftag4.js +++ b/test/cases/memberoftag4.js @@ -8,5 +8,10 @@ Call( valueOf: function() { return this.id; + }, + + toString: function() + { + return this.id; } }); \ No newline at end of file diff --git a/test/runner.js b/test/runner.js index 35c04d24..044352e8 100644 --- a/test/runner.js +++ b/test/runner.js @@ -123,6 +123,7 @@ testFile('test/t/cases/constructstag3.js'); testFile('test/t/cases/constructstag4.js'); testFile('test/t/cases/constructstag5.js'); testFile('test/t/cases/constructortag.js'); +testFile('test/t/cases/constructorproperty.js'); testFile('test/t/cases/copyrighttag.js'); testFile('test/t/cases/defaulttag.js'); testFile('test/t/cases/deprecatedtag.js'); diff --git a/test/t/cases/constructorproperty.js b/test/t/cases/constructorproperty.js new file mode 100644 index 00000000..08d75fb1 --- /dev/null +++ b/test/t/cases/constructorproperty.js @@ -0,0 +1,8 @@ +(function() { + + test('Should not crash when "contructor" property is used in Object.create() parameter', function() { + var docSet = testhelpers.getDocSetFromFile('test/cases/contructorproperty.js'); + assert.ok(true); + }); + +})(); \ No newline at end of file