| Test for XPath substring() function behavior, adapted from Chromium XPathFunctionsTest. |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| PASS document.evaluate("substring(\"motor car\", 6)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is " car" |
| PASS document.evaluate("substring(\"metadata\", 4, 3)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "ada" |
| PASS document.evaluate("substring(\"123456\", 1.5, 2.6)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "234" |
| PASS document.evaluate("substring(\"12345\", 0, 3)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "12" |
| PASS document.evaluate("substring(\"12345\", 5, -3)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"12345\", -3, 5)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "1" |
| PASS document.evaluate("substring(\"12345\", number(\"NaN\"), 3)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"12345\", 1, number(\"NaN\"))", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"\", 0, 1)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"well hello there\", 6, 5)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "hello" |
| PASS document.evaluate("substring(\"hello, world!\", -4, 10)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "hello" |
| PASS document.evaluate("substring(\"hello\", -9007199254740990, 1)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"hello, world!\", 1, -3)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"foo\", -9007199254740991, 1)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS document.evaluate("substring(\"12345\", -42, 999999999)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "12345" |
| PASS document.evaluate("substring(\"no way\", 999999999, 7)", document.body, null, XPathResult.STRING_TYPE, null).stringValue is "" |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |