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

Unified Diff: test/mjsunit/es6/string-repeat.js

Issue 1454543003: [es6] Allow any valid repeat of empty string in String.prototype.repeat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 1 month 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 | « src/js/string.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/string-repeat.js
diff --git a/test/mjsunit/es6/string-repeat.js b/test/mjsunit/es6/string-repeat.js
index 15caea14f3d788fac865dffc6cda4b42540d94a4..d61aec066c8dbd93acc79c5751629db4f0611726 100644
--- a/test/mjsunit/es6/string-repeat.js
+++ b/test/mjsunit/es6/string-repeat.js
@@ -65,6 +65,12 @@ assertThrows('"a".repeat(Number.POSITIVE_INFINITY)', RangeError);
assertThrows('"a".repeat(Math.pow(2, 30))', RangeError);
assertThrows('"a".repeat(Math.pow(2, 40))', RangeError);
+// Handling empty strings
+assertThrows('"".repeat(-1)', RangeError);
+assertThrows('"".repeat(Number.POSITIVE_INFINITY)', RangeError);
+assertEquals("", "".repeat(Math.pow(2, 30)));
+assertEquals("", "".repeat(Math.pow(2, 40)));
+
var myobj = {
toString: function() {
return "abc";
« no previous file with comments | « src/js/string.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698