Permalink
Browse files

backport r148706

svn path=/branches/mono-2-6/mcs/; revision=148707
  • Loading branch information...
1 parent 82f0bca commit 3a989e7d01e337d2c77bb3218effe39f9ed90a02 Sebastien Pouliot committed Dec 17, 2009
@@ -1,3 +1,8 @@
+2009-12-17 Sebastien Pouliot <sebastien@ximian.com>
+
+ * String.cs: Fix #565602 right-padding empty strings.
+ [Backport r148706]
+
2009-12-09 Jb Evain <jbevain@novell.com>
* StringComparer.cs (GetHashCode): properly throw an
@@ -1531,7 +1531,7 @@ public unsafe String PadRight (int totalWidth, char paddingChar)
if (totalWidth < this.length)
return this;
- if (this.Length == 0)
+ if (totalWidth == 0)
return String.Empty;
String tmp = InternalAllocateStr (totalWidth);
@@ -1,3 +1,8 @@
+2009-12-17 Sebastien Pouliot <sebastien@ximian.com>
+
+ * StringTest.cs: Add test case for right padding an empty string
+ [Backport r148706]
+
2009-11-24 Jb Evain <jbevain@novell.com>
* ArrayTest.cs: test that we don't allow the use of the IList indexer
@@ -3011,6 +3011,13 @@ public void PadRight1_TotalWidth_Negative ()
}
}
+ [Test]
+ public void PadRight2 ()
+ {
+ Assert.AreEqual ("100000000000", "1".PadRight (12, '0'), "#1");
+ Assert.AreEqual ("000000000000", "".PadRight (12, '0'), "#2");
+ }
+
[Test] // Remove (Int32, Int32)
public void Remove2 ()
{

0 comments on commit 3a989e7

Please sign in to comment.