SVN commit 762053 by orlovich: Some regression tests for String.prototype.substr M +10 -0 StringObject.js --- trunk/tests/khtmltests/regression/tests/js/StringObject.js #762052:762053 @@ -109,6 +109,16 @@ shouldBe("'a'.localeCompare('')", "1"); shouldBe("'a'.localeCompare()", "0"); +// String.prototype.substr() +shouldBe('"abcdef".substr(1)', '"bcdef"'); +shouldBe('"abcdef".substr(-1)', '"f"'); +shouldBe('"abcdef".substr(1, 2)', '"bc"'); +shouldBe('"abcdef".substr(-1, 2)', '"f"'); +shouldBe('"abcdef".substr(1, 0)', '""'); +shouldBe('"abcdef".substr(-1, 0)', '""'); +shouldBe('"abcdef".substr(1, NaN)', '""'); +shouldBe('"abcdef".substr(-1, NaN)', '""'); + // warning: prototype modification below shouldBe("'abc'[0]", "'a'"); shouldBeUndefined("'abc'[-1]");