Changeset 15473 in webkit for trunk/JavaScriptCore/API/testapi.js
- Timestamp:
- Jul 16, 2006, 6:48:27 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/testapi.js
r15462 r15473 40 40 } 41 41 42 function shouldThrow(a) 43 { 44 var result = "__FAIL__: " + a + " did not throw an exception."; 45 46 var evalA; 47 try { 48 eval(a); 49 } catch(e) { 50 result = "PASS: " + a + " threw: " + e; 51 } 52 53 print(result); 54 } 55 42 56 shouldBe("typeof MyObject", "function"); // our object implements 'call' 43 57 MyObject.cantFind = 1; … … 69 83 : "__FAIL__: MyObject.regularType was not enumerated"); 70 84 85 myObject = new MyObject(); 86 71 87 shouldBe("delete MyObject.regularType", true); 72 88 shouldBe("MyObject.regularType", undefined); 73 89 shouldBe("MyObject(0)", 1); 74 90 shouldBe("MyObject()", undefined); 75 shouldBe("typeof new MyObject()", "object");91 shouldBe("typeof myObject", "object"); 76 92 shouldBe("MyObject ? 1 : 0", true); // toBoolean 77 93 shouldBe("+MyObject", 1); // toNumber … … 83 99 shouldBe("typeof constructedObject", "object"); 84 100 shouldBe("constructedObject.value", 1); 85 shouldBe(" (new MyObject())instanceof MyObject", true);101 shouldBe("myObject instanceof MyObject", true); 86 102 shouldBe("(new Object()) instanceof MyObject", false); 103 104 shouldThrow("MyObject.nullGetSet = 1"); 105 shouldThrow("MyObject.nullGetSet"); 106 shouldThrow("MyObject.nullCall()"); 107 shouldThrow("MyObject.hasPropertyLie");
Note:
See TracChangeset
for help on using the changeset viewer.