Index: test/webkit/string-substr.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/string-substr.js |
similarity index 52% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/string-substr.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..c9a42747ad62c16efd45467f13a8995e3662ddc7 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/string-substr.js |
@@ -22,10 +22,45 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating." |
+"This test checks the boundary cases of substr()." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+shouldBe("'bar'.substr(0)", "'bar'"); |
+shouldBe("'bar'.substr(3)", "''"); |
+shouldBe("'bar'.substr(4)", "''"); |
+shouldBe("'bar'.substr(-1)", "'r'"); |
+shouldBe("'bar'.substr(-3)", "'bar'"); |
+shouldBe("'bar'.substr(-4)", "'bar'"); |
+shouldBe("'bar'.substr(0, 0)", "''"); |
+shouldBe("'bar'.substr(0, 1)", "'b'"); |
+shouldBe("'bar'.substr(0, 3)", "'bar'"); |
+shouldBe("'bar'.substr(0, 4)", "'bar'"); |
+shouldBe("'bar'.substr(1, 0)", "''"); |
+shouldBe("'bar'.substr(1, 1)", "'a'"); |
+shouldBe("'bar'.substr(1, 2)", "'ar'"); |
+shouldBe("'bar'.substr(1, 3)", "'ar'"); |
+ |
+shouldBe("'bar'.substr(3, 0)", "''"); |
+shouldBe("'bar'.substr(3, 1)", "''"); |
+shouldBe("'bar'.substr(3, 3)", "''"); |
+ |
+shouldBe("'bar'.substr(4, 0)", "''"); |
+shouldBe("'bar'.substr(4, 1)", "''"); |
+shouldBe("'bar'.substr(4, 3)", "''"); |
+ |
+shouldBe("'bar'.substr(-1, 0)", "''"); |
+shouldBe("'bar'.substr(-1, 1)", "'r'"); |
+ |
+shouldBe("'bar'.substr(-3, 1)", "'b'"); |
+shouldBe("'bar'.substr(-3, 3)", "'bar'"); |
+shouldBe("'bar'.substr(-3, 4)", "'bar'"); |
+ |
+shouldBe("'bar'.substr(-4)", "'bar'"); |
+shouldBe("'bar'.substr(-4, 0)", "''"); |
+shouldBe("'bar'.substr(-4, 1)", "'b'"); |
+shouldBe("'bar'.substr(-4, 3)", "'bar'"); |
+shouldBe("'bar'.substr(-4, 4)", "'bar'"); |
+ |
+shouldBe("'GMAIL_IMP=bf-i%2Fd-0-0%2Ftl-v'.substr(10)", "'bf-i%2Fd-0-0%2Ftl-v'"); |