[Rubytests-devel] assert_set_equal problematic !?

Charles O Nutter headius at gmail.com
Thu Nov 11 11:08:10 EST 2004


It sounds good to me; I'm glad to hear the new version didn't break
anything too. The new version should help avoid duplicates slipping
through that should not.

Commit it and I'll run against JRuby too.


On Thu, 11 Nov 2004 14:42:42 +0100 (MET), Johan Holmberg
<holmberg at iar.se> wrote:
> 
> On Wed, 10 Nov 2004, Charles O Nutter wrote:
> >
> > It's probably worth a look around the whole of rubicon to see how it's
> > being used and if it's actually serving any useful purpose.
> >
> 
> The typical use seem to be to test a method that return an array of
> for example instance-variables, methods of a class or something
> similar. In these cases the order is apparently not essential.
> 
> But I suppose returning duplicates really would be considered an
> error. So the current implementation of "assert_set_equal"
> is probably not as strict as it should be (maybe by "implementation
> coincidence").
> 
> I went ahead and re-implemented the assert_set_equal method to *not*
> remove duplicates. I also avoided using "sort" internally: just
> removed equal elements pairwise from both arrays, and saw if I ended
> up with two empty arrays.
> 
> With this change I got *no* new errors while running the whole
> testsuite, even though this new version of the assertion is stricter
> than how it was before.
> 
> After thinking a bit more about this, I would like to commit this
> change. After all it is quite convenient to not having to do a lot
> of explicit sorts inline in the testcases. And I also like to be
> able to avoid "sort" calls (even if I guess most of these cases
> involves strings).
> 
> OK ?
> 
> 
> 
> /Johan
> 
> _______________________________________________
> Rubytests-devel mailing list
> Rubytests-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubytests-devel
>


More information about the Rubytests-devel mailing list