[Mono-dev] Regression in String tests

Jamie Cansdale jamie.cansdale at testdriven.net
Tue Mar 6 03:03:58 EST 2007


>                          PropertyInfo[] props = typeof(String).GetProperties();
>                          AssertEquals(props[0].Name, "Chars");
>                          AssertEquals(props[1].Name, "Length");

I'm curious it know what this is testing for. I thought the ordering
of reflected members was explicitly not guaranteed. IIRC there was
talk of returning them in random order in .NET 2.0 to discourage this
kind of dependency.

Thanks, Jamie.

--
http://www.testdriven.net
http://weblogs.asp.net/nunitaddin



On 3/6/07, Atsushi Eno <atsushi at ximian.com> wrote:
> It is not a regression. Actually the test is quite odd.
>
>                  [Test]
>                  public void StringProperties()
>                  {
>                          PropertyInfo[] props = typeof(String).GetProperties();
>                          AssertEquals(props[0].Name, "Chars");
>                          AssertEquals(props[1].Name, "Length");
>                  }
>
> I'll revert r73699.
>
> Atsushi Eno
>
> Miguel de Icaza wrote:
> > I just noticed this while running the corlib tests:
> >
> > Failures:
> > 1) MonoTests.System.StringTest.StringProperties :
> >         String lengths differ.  Expected length=6, but was length=5.
> >         Strings differ at index 0.
> >
> >         expected:<"Length">
> >          but was:<"Chars">
> >         -----------^
> >
> >   at MonoTests.System.StringTest.StringProperties () [0x00010]
> > in /home/cvs/mcs/class/corlib/Test/System/StringTest.cs:1807
> >   at <0x00000> <unknown method>
> >   at (wrapper managed-to-native)
> > System.Reflection.MonoMethod:InternalInvoke (object,object[])
> >   at System.Reflection.MonoMethod.Invoke (System.Object obj,
> > BindingFlags invokeAttr, System.Reflection.Binder binder,
> > System.Object[] parameters, System.Globalization.CultureInfo culture)
> > [0x00040]
> > in /home/cvs/mcs/class/corlib/System.Reflection/MonoMethod.cs:143
> >
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
>
> _______________________________________________
> 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