I noticed this in core\thread\current_spec.rb.
it "returns the current thread" do
t = Thread.new { Thread.current }
t.value.should equal(t)
Thread.current.should_not equal(t.value)
end
Is this any different than writing "t.value.should == t"? Is either of
them the recommended way? Seems odd to support two ways of writing the exact
same thing.
Thanks,
Shri
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090107/0a58a64a/attachment-0001.html>
require ''mspec''
describe "equals" do
it "compares objects not values" do
a = "a"
b = "a"
c = a
a.should equal(c)
a.should_not equal(b)
a.should == b
end
end
On Wed, Jan 7, 2009 at 3:48 AM, Shri Borde <Shri.Borde at microsoft.com>
wrote:
> I noticed this in core\thread\current_spec.rb.
>
>
>
> it "returns the current thread" do
>
> t = Thread.new { Thread.current }
>
> t.value.should equal(t)
>
> Thread.current.should_not equal(t.value)
>
> end
>
>
>
> Is this any different than writing "t.value.should == t"? Is
either of them
> the recommended way? Seems odd to support two ways of writing the exact
same
> thing.
>
>
>
> Thanks,
>
> Shri
>
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
--
Michael Letterle
[Polymath Prokrammer]
http://blog.prokrams.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090107/a2d83321/attachment.html>
Along those lines, you have to remember that Ruby has 4 distinct ways to define
equality. #eql?, #equal?, #== and #===. This post covers it:
http://probablycorey.wordpress.com/2008/02/26/ruby-equality-equal-eql-and/
JD
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Michael Letterle
Sent: Wednesday, January 07, 2009 11:26 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] should equal in RubySpecs
require ''mspec''
describe "equals" do
it "compares objects not values" do
a = "a"
b = "a"
c = a
a.should equal(c)
a.should_not equal(b)
a.should == b
end
end
On Wed, Jan 7, 2009 at 3:48 AM, Shri Borde <Shri.Borde at
microsoft.com<mailto:Shri.Borde at microsoft.com>> wrote:
I noticed this in core\thread\current_spec.rb.
it "returns the current thread" do
t = Thread.new { Thread.current }
t.value.should equal(t)
Thread.current.should_not equal(t.value)
end
Is this any different than writing "t.value.should == t"? Is either of
them the recommended way? Seems odd to support two ways of writing the exact
same thing.
Thanks,
Shri
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
--
Michael Letterle
[Polymath Prokrammer]
http://blog.prokrams.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090107/963af3d6/attachment-0001.html>
I see. should== is value equality, and should+equal is reference equality.
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Michael Letterle
Sent: Wednesday, January 07, 2009 11:26 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] should equal in RubySpecs
require ''mspec''
describe "equals" do
it "compares objects not values" do
a = "a"
b = "a"
c = a
a.should equal(c)
a.should_not equal(b)
a.should == b
end
end
On Wed, Jan 7, 2009 at 3:48 AM, Shri Borde <Shri.Borde at
microsoft.com<mailto:Shri.Borde at microsoft.com>> wrote:
I noticed this in core\thread\current_spec.rb.
it "returns the current thread" do
t = Thread.new { Thread.current }
t.value.should equal(t)
Thread.current.should_not equal(t.value)
end
Is this any different than writing "t.value.should == t"? Is either of
them the recommended way? Seems odd to support two ways of writing the exact
same thing.
Thanks,
Shri
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
--
Michael Letterle
[Polymath Prokrammer]
http://blog.prokrams.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090107/8f9abf8e/attachment.html>