tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

replace-rope-empty.js (910B)


      1 // |reftest| skip-if(!xulRuntime.shell)
      2 
      3 var BUGNUMBER = 1509768;
      4 var summary = "String#replace with an empty string pattern on a rope should prepend the replacement string.";
      5 
      6 print(BUGNUMBER + ": " + summary);
      7 
      8 // Rope is created when the string length >= 25.
      9 //
     10 // This testcase depends on that condition to reliably test the code for
     11 // String#replace on a rope.
     12 //
     13 // Please rewrite this testcase when the following assertion fails.
     14 assertEq(isRope("a".repeat(24)), false);
     15 assertEq(isRope("a".repeat(25)), true);
     16 
     17 // Not a rope.
     18 assertEq("a".repeat(24).replace("", "foo"),
     19         "foo" + "a".repeat(24));
     20 assertEq("a".repeat(24).replace("", ""),
     21         "a".repeat(24));
     22 
     23 // A rope.
     24 assertEq("a".repeat(25).replace("", "foo"),
     25         "foo" + "a".repeat(25));
     26 assertEq("a".repeat(25).replace("", ""),
     27         "a".repeat(25));
     28 
     29 if (typeof reportCompare === "function")
     30    reportCompare(true, true);