Changeset 43560 in webkit for trunk/JavaScriptCore/tests
- Timestamp:
- May 12, 2009, 2:18:44 AM (16 years ago)
- Location:
- trunk/JavaScriptCore/tests/mozilla/ecma_2/instanceof
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js
r11995 r43560 17 17 Author: [email protected] 18 18 Date: 12 november 1997 19 20 21 The test case described above is correct, however the second test case in this file is not, 22 'o instanceof o' should thow an exception. According to ECMA-262: 23 24 8.6.2 Internal Properties and Methods: 25 "... only Function objects implement [[HasInstance]]" 26 11.8.6 The instanceof operator: 27 "6.If Result(4) does not have a [[HasInstance]] method, throw a TypeError exception." 28 29 {} does not implement [[HasInstance]] (since it is not a function), so passing it as the 30 constructor to be tested to instanceof should result in a TypeError being thrown. 31 19 32 */ 20 33 var SECTION = "instanceof-003"; … … 36 49 37 50 38 var o = {};39 40 51 AddTestCase( 41 52 "o = {}; o instanceof o", 42 false,43 o instanceof o);53 "EXCEPTION", 54 (function(){ try { var o = {}; o instanceof o; return "no exception"; } catch (e) { return "EXCEPTION"; } } )() ); 44 55 45 56 -
trunk/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js
r11995 r43560 27 27 */ 28 28 29 30 31 32 29 var SECTION = "instanceof"; // provide a document reference (ie, ECMA section) 30 var VERSION = "ECMA_2"; // Version of JavaScript or ECMA 31 var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description 32 var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7635"; // Provide URL to bugsplat or bugzilla report 33 33 34 34 startTest(); // leave this alone 35 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 36 /* 37 * Calls to AddTestCase here. AddTestCase is a function that is defined 38 * in shell.js and takes three arguments: 39 * - a string representation of what is being tested 40 * - the expected result 41 * - the actual result 42 * 43 * For example, a test might look like this: 44 * 45 * var zip = /[\d]{5}$/; 46 * 47 * AddTestCase( 48 * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test 49 * "02134", // expected result 50 * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result 51 * 52 */ 53 53 54 55 56 57 54 function Foo() {} 55 theproto = {}; 56 Foo.prototype = theproto 57 theproto instanceof Foo 58 58 59 59 60 AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo", 61 false, 62 theproto instanceof Foo ); 63 64 var o = {}; 60 AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo", 61 false, 62 theproto instanceof Foo ); 65 63 66 AddTestCase( "var o = {}; o instanceof o", false, o instanceof o);64 var f = new Function(); 67 65 68 var f = new Function(); 69 70 AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f ); 66 AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f ); 71 67 72 68 73 74 69 test(); // leave this alone. this executes the test cases and 70 // displays results.
Note:
See TracChangeset
for help on using the changeset viewer.