Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: test/webkit/string-substr.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/webkit/string-sort-expected.txt ('k') | test/webkit/string-substr-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'");
« no previous file with comments | « test/webkit/string-sort-expected.txt ('k') | test/webkit/string-substr-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698