2008-04-02 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 2 Apr 2008 06:55:00 +0000 (06:55 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 2 Apr 2008 06:55:00 +0000 (06:55 -0000)
* SortKey.cs : check null arguments. Fixed bug #376171.

* SortKeyTest.cs : new test, for bug #376171.

* corlib_test.dll.sources : added SortKeyTest.cs.

svn path=/trunk/mcs/; revision=99609

mcs/class/corlib/ChangeLog
mcs/class/corlib/Mono.Globalization.Unicode/ChangeLog
mcs/class/corlib/Mono.Globalization.Unicode/SortKey.cs
mcs/class/corlib/Test/System.Globalization/ChangeLog
mcs/class/corlib/Test/System.Globalization/SortKeyTest.cs [new file with mode: 0644]
mcs/class/corlib/corlib_test.dll.sources

index aef33522fc4e383c6a0b6516165c4222fe3cf5c5..94b5e77dc34a05499e6a5238663cfc864b4be5ad 100644 (file)
@@ -1,3 +1,7 @@
+2008-04-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * corlib_test.dll.sources : added SortKeyTest.cs.
+
 2008-03-21  Sebastien Pouliot  <sebastien@ximian.com> 
 
        * corlib_test.dll.sources: Add unit tests for EqualityComparer
index 52809a14213c975695ea14d843d1b765ccfb03e0..9ae9de9d7d527cc9e5db6897a9bf23cb000a6b25 100644 (file)
@@ -1,3 +1,7 @@
+2008-04-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SortKey.cs : check null arguments. Fixed bug #376171.
+
 2007-07-20  Atsushi Enomoto  <atsushi@ximian.com>
 
        * create-mscompat-collation-table.cs : I wonder how long its build
index f6b86f774aa518508391efeb94b4a1518ac6f495..bcccf13fe35999bb2aedad6b0de31d94b74aeb9f 100644 (file)
@@ -42,6 +42,11 @@ namespace System.Globalization
                #region Static members
                public static int Compare (SortKey sk1, SortKey sk2)
                {
+                       if (sk1 == null)
+                               throw new ArgumentNullException ("sk1");
+                       if (sk2 == null)
+                               throw new ArgumentNullException ("sk2");
+
                        if (Object.ReferenceEquals (sk1, sk2)
                                || Object.ReferenceEquals (sk1.OriginalString,
                                sk2.OriginalString))
index 61021c7a99a7083db89a3cf4400964459f8af9db..70f271236a36bbddf1cb7d37241874858d29fbac 100644 (file)
@@ -1,3 +1,7 @@
+2008-04-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SortKeyTest.cs : new test, for bug #376171.
+
 2007-11-03  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DateTimeFormatInfoTest.cs : enabled test for bug #332553.
diff --git a/mcs/class/corlib/Test/System.Globalization/SortKeyTest.cs b/mcs/class/corlib/Test/System.Globalization/SortKeyTest.cs
new file mode 100644 (file)
index 0000000..9f67353
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// SortKeyTest.cs
+//
+// Author:
+//     Atsushi Enomoto  <atsushi@ximian.com>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace MonoTests.System.Globalization
+{
+
+       [TestFixture]
+       public class SortKeyTest
+       {
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void CompareNull ()
+               {
+                       // bug #376171
+                       SortKey.Compare (null, null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void CompareNull2 ()
+               {
+                       // bug #376171
+                       SortKey.Compare (CultureInfo.InvariantCulture.CompareInfo.GetSortKey ("A"), null);
+               }
+       }
+
+}
index 9cbb7a1c4d2ac3187a5177dacd0a0ebc8a3c2ff0..79f584e973cb992d8165dd838f738d97b4d5103c 100644 (file)
@@ -68,6 +68,7 @@ System.Globalization/DaylightTimeTest.cs
 System.Globalization/EastAsianLunisolarCalendarTest.cs
 System.Globalization/IdnMappingTest.cs
 System.Globalization/RegionInfoTest.cs
+System.Globalization/SortKeyTest.cs
 System.Globalization/StringInfoTest.cs
 System.Globalization/TextInfoTest.cs
 System/GuidTest.cs