diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2009-12-17 18:31:21 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2009-12-17 18:31:21 +0300 |
commit | 3a989e7d01e337d2c77bb3218effe39f9ed90a02 (patch) | |
tree | 61636e60ca7e4443472468ea4ea26a6db3445a69 | |
parent | 82f0bcaa7d8b11ba1efd670196b132c1023cbc5f (diff) |
backport r148706mono-2-6-1
svn path=/branches/mono-2-6/mcs/; revision=148707
-rw-r--r-- | mcs/class/corlib/System/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/corlib/System/String.cs | 2 | ||||
-rw-r--r-- | mcs/class/corlib/Test/System/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/corlib/Test/System/StringTest.cs | 7 |
4 files changed, 18 insertions, 1 deletions
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index a4ab5845574..368ee855c12 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -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 diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs index a2d5b21d125..06a9914af4e 100644 --- a/mcs/class/corlib/System/String.cs +++ b/mcs/class/corlib/System/String.cs @@ -1531,7 +1531,7 @@ namespace System if (totalWidth < this.length) return this; - if (this.Length == 0) + if (totalWidth == 0) return String.Empty; String tmp = InternalAllocateStr (totalWidth); diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog index c66745078da..573becb4bcb 100644 --- a/mcs/class/corlib/Test/System/ChangeLog +++ b/mcs/class/corlib/Test/System/ChangeLog @@ -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 diff --git a/mcs/class/corlib/Test/System/StringTest.cs b/mcs/class/corlib/Test/System/StringTest.cs index 9e6bd64e349..b155da7a273 100644 --- a/mcs/class/corlib/Test/System/StringTest.cs +++ b/mcs/class/corlib/Test/System/StringTest.cs @@ -3011,6 +3011,13 @@ public class StringTest } } + [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 () { |