[Mono-dev] Patch for Bug 650365
Nikolaos Georgiou
nikolaos.georgiou at gmail.com
Sun Oct 31 13:41:16 EDT 2010
On 31/10/2010 9:35 ΠΜ, Stifu wrote:
> Note that you may attach the patch directly to the bug report, which may be
> more convenient and make it less likely to get lost.
>
> Also, if you provide unit tests that highlight what your patch fixes (as a
> 2nd patch, that updates the existing unit tests), then developers are likely
> to apply your patch faster, as they'll be more confident in the changes.
>
Hi,
actually I found a wiki page describing that Mono has moved to github
and instructions on how to make your changes and the ask for a pull,
which is what I did:
http://github.com/mono/mono/pull/21
I don't know if Mono has some guidelines on associating bugs in bugzilla
with pull requests in github ... ?
Regards,
Nikolaos
> Nikolaos Georgiou-2 wrote:
>> Hello all,
>>
>> earlier this day I discovered a bug in System.Resources:
>> https://bugzilla.novell.com/show_bug.cgi?id=650365
>>
>> I was able to fix it by myself. The patch is in the attached file. It
>> includes the modification in the source code and one unit test.
>>
>> Is this the correct way to submit a fix? Should I do something else?
>>
>> Regards,
>> Nikolaos Georgiou
>>
>>
>> diff --git
>> a/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
>> b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
>> index 5c274ab..fa03e85 100644
>> ---
>> a/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
>> +++
>> b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
>> @@ -241,7 +241,7 @@ namespace System.Resources
>> private void AddResource (string name, object value, string comment)
>> {
>> if (value is string) {
>> - AddResource (name, (string) value);
>> + AddResource (name, (string) value, comment);
>> return;
>> }
>>
>> @@ -294,6 +294,11 @@ namespace System.Resources
>>
>> public void AddResource (string name, string value)
>> {
>> + AddResource (name, value, string.Empty);
>> + }
>> +
>> + public void AddResource (string name, string value, string comment)
>> + {
>> if (name == null)
>> throw new ArgumentNullException ("name");
>>
>> @@ -306,7 +311,7 @@ namespace System.Resources
>> if (writer == null)
>> InitWriter ();
>>
>> - WriteString (name, value);
>> + WriteString (name, value, null, comment);
>> }
>>
>> #if NET_2_0
>> diff --git
>> a/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs
>> b/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs
>> index 90abb81..5814719 100644
>> --- a/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs
>> +++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs
>> @@ -8,6 +8,7 @@
>> using System;
>> using System.Collections;
>> using System.ComponentModel;
>> +using System.ComponentModel.Design;
>> using System.Drawing;
>> using System.Globalization;
>> using System.IO;
>> @@ -101,6 +102,39 @@ namespace MonoTests.System.Resources
>> }
>>
>> [Test]
>> + public void AddResource_WithComment ()
>> + {
>> + ResXResourceWriter w = new ResXResourceWriter (fileName);
>> + ResXDataNode node = new ResXDataNode ("key", "value");
>> + node.Comment = "comment is preserved";
>> + w.AddResource (node);
>> + w.Generate ();
>> + w.Close ();
>> +
>> + ResXResourceReader r = new ResXResourceReader (fileName);
>> + ITypeResolutionService typeres = null;
>> + r.UseResXDataNodes = true;
>> +
>> + int count = 0;
>> + foreach (DictionaryEntry o in r)
>> + {
>> + string key = o.Key.ToString();
>> + node = (ResXDataNode)o.Value;
>> + string value = node.GetValue (typeres).ToString ();
>> + string comment = node.Comment;
>> +
>> + Assert.AreEqual ("key", key, "key");
>> + Assert.AreEqual ("value", value, "value");
>> + Assert.AreEqual ("comment is preserved", comment, "comment");
>> + Assert.AreEqual (0, count, "too many nodes");
>> + count++;
>> + }
>> + r.Close ();
>> +
>> + File.Delete (fileName);
>> + }
>> +
>> + [Test]
>> public void TestWriter ()
>> {
>> ResXResourceWriter w = new ResXResourceWriter (fileName);
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>>
More information about the Mono-devel-list
mailing list