OLD | NEW |
1 description("Tests the properties of the XPathException object.") | 1 description("Tests the properties of the XPathException object.") |
2 | 2 |
3 var e; | 3 var e; |
4 try { | 4 try { |
5 var evalulator = new XPathEvaluator; | 5 var evalulator = new XPathEvaluator; |
6 var nsResolver = evalulator.createNSResolver(document); | 6 var nsResolver = evalulator.createNSResolver(document); |
7 var result = evalulator.evaluate("/body", document, nsResolver, 0, null); | 7 var result = evalulator.evaluate("/body", document, nsResolver, 0, null); |
8 var num = result.numberValue; | 8 var num = result.numberValue; |
9 // raises a TYPE_ERR | 9 // raises a TYPE_ERR |
10 } catch (err) { | 10 } catch (err) { |
11 e = err; | 11 e = err; |
12 } | 12 } |
13 | 13 |
14 shouldBeEqualToString("e.toString()", "Error: TYPE_ERR: DOM XPath Exception 52")
; | 14 shouldBeEqualToString("e.toString()", "TYPE_ERR: The expression could not be con
verted to return the specified type."); |
15 shouldBeEqualToString("Object.prototype.toString.call(e)", "[object XPathExcepti
on]"); | 15 shouldBeEqualToString("Object.prototype.toString.call(e)", "[object XPathExcepti
on]"); |
16 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object XP
athExceptionPrototype]"); | 16 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object XP
athExceptionPrototype]"); |
17 shouldBeEqualToString("e.constructor.toString()", "function XPathException() { [
native code] }"); | 17 shouldBeEqualToString("e.constructor.toString()", "function XPathException() { [
native code] }"); |
18 shouldBe("e.constructor", "window.XPathException"); | 18 shouldBe("e.constructor", "window.XPathException"); |
19 shouldBe("e.TYPE_ERR", "e.constructor.TYPE_ERR"); | 19 shouldBe("e.TYPE_ERR", "e.constructor.TYPE_ERR"); |
20 shouldBe("e.INVALID_EXPRESSION_ERR", "51"); | 20 shouldBe("e.INVALID_EXPRESSION_ERR", "51"); |
21 shouldBe("e.TYPE_ERR", "52"); | 21 shouldBe("e.TYPE_ERR", "52"); |
OLD | NEW |