[Bug #891] MiniTest::Assertions#assert_instance_of should use Object#instance_of?


#1

Bug #891: MiniTest::Assertions#assert_instance_of should use
Object#instance_of?
http://redmine.ruby-lang.org/issues/show/891

e$B5/I<<Te(B: okkez _
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: lib

e$B%?%$%H%k$NDL$j$J$N$G$9$,!"e(BMiniTest::Assertions#assert_instance_of
e$B$N<BAu$,$*$+$7$$$H;W$$$^$9!#e(B
Module#=== e$B$G$O$J$/$Fe(B Object#instance_of?
e$B$r;HMQ$9$k$Y$-$G$O$J$$$G$7$g$&$+!)e(B
test/unit e$B$G$Oe(B Object#instance_of? e$B$r;HMQ$7$F$$$^$7$?!#e(B


#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37458] [Bug #891]
MiniTest::Assertions#assert_instance_of should use Object#instance_of?”
on Tue, 16 Dec 2008 16:26:38 +0900, okkez _ removed_email_address@domain.invalid
writes:

|e$B%?%$%H%k$NDL$j$J$N$G$9$,!"e(BMiniTest::Assertions#assert_instance_of e$B$N<BAu$,$*$+$7$$$H;W$$$^$9!#e(B
|Module#=== e$B$G$O$J$/$Fe(B Object#instance_of? e$B$r;HMQ$9$k$Y$-$G$O$J$$$G$7$g$&$+!)e(B

e$B$3$N$U$?$D$OF1$8F/$-$G$9$,!"!V$*$+$7$$!W$H$$$&$N$O$I$&$$$&0Ue(B
e$BL#$G$7$g$&$+!#!V$h$jNI$/0U?^$rI=8=$9$k!W$H$+$$$&$h$&$J0UL#$Ge(B
e$B$"$l$P!"%P%0$H$O8@$($J$$$h$&$J!#e(B


#3

From: Yukihiro M. removed_email_address@domain.invalid
Subject: [ruby-dev:37459] Re: [Bug #891]
MiniTest::Assertions#assert_instance_of should use Object#instance_of?
Date: Tue, 16 Dec 2008 17:33:46 +0900

|Module#=== e$B$G$O$J$/$Fe(B Object#instance_of? e$B$r;HMQ$9$k$Y$-$G$O$J$$$G$7$g$&$+!)e(B

e$B$3$N$U$?$D$OF1$8F/$-$G$9$,!"!V$*$+$7$$!W$H$$$&$N$O$I$&$$$&0Ue(B

Object#instance_of?e$B$O%5%V%/%i%9$@$H$@$a$G$9$h$M!#e(B

Numeric === 1 # => true
Fixnum === 1 # => true
1.instance_of? Fixnum # => true
1.instance_of? Numeric # => false


#4

okkez e$B$G$9!#e(B

Ruby

e$B$N%j%S%k%I$r$7$F$k4V$K$k$S$-$A$5$s$,%U%)%m!<$7$F$/$@$5$C$F$^$9$,e(B

e$B$5$C$-%S%k%I$7$?e(B Ruby e$B$G3NG’$7$F$_$^$7$?!#e(B

2008/12/16 17:33 Yukihiro M. removed_email_address@domain.invalid:

e$B$"$l$P!"%P%0$H$O8@$($J$$$h$&$J!#e(B

e$B0J2<$N$h$&$J<B9T7k2L$K$J$k$+$i$G$9!#e(B
Object#instance_of?(klass) e$B$O%l%7!<%P$,e(B klass
e$B$ND>@$N%$%s%9%?%s%9$K$J$C$F$$$ke(B
e$B>l9g$@$1e(B true e$B$rJV$7$^$9!#e(B

RUBY_DESCRIPTION
=> “ruby 1.9.1 (2008-12-16 revision 20782) [i686-linux]”

String === ‘a’
=> true

Object === ‘a’
=> true

‘a’.kind_of?(String)
=> true

‘a’.kind_of?(Object)
=> true

‘a’.instance_of?(String)
=> true

‘a’.instance_of?(Object)
=> false


#5

e$B%A%1%C%He(B #891 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r20798.

http://redmine.ruby-lang.org/issues/show/891


#6

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37464] Re: [Bug #891]
MiniTest::Assertions#assert_instance_of should use Object#instance_of?”
on Tue, 16 Dec 2008 20:22:23 +0900, okkez removed_email_address@domain.invalid
writes:

|e$B0J2<$N$h$&$J<B9T7k2L$K$J$k$+$i$G$9!#e(B
|Object#instance_of?(klass) e$B$O%l%7!<%P$,e(B klass e$B$ND>@$N%$%s%9%?%s%9$K$J$C$F$$$ke(B
|e$B>l9g$@$1e(B true e$B$rJV$7$^$9!#e(B

e$B$J$k$[$I!#%3%_%C%H$7$^$9!#e(B

e$B$?$@!“e(Bminiteste$B$Oe(BRyan D.e$B$,%a%s%F%J$G$9$+$i!”:#8e$Oe(B
ruby-coree$B$K%l%]!<%H$7$F$$$?$@$/$N$,3N<B$@$H;W$$$^$9!#:#2s$Ne(B
e$B%3%_%C%H$,%m%9%H$7$J$-$c$$$$$1$I!#e(B


#7

okkez e$B$G$9!#e(B

2008/12/16 22:05 Yukihiro M. removed_email_address@domain.invalid:

e$B$?$@!“e(Bminiteste$B$Oe(BRyan D.e$B$,%a%s%F%J$G$9$+$i!”:#8e$Oe(B
ruby-coree$B$K%l%]!<%H$7$F$$$?$@$/$N$,3N<B$@$H;W$$$^$9!#:#2s$Ne(B
e$B%3%_%C%H$,%m%9%H$7$J$-$c$$$$$1$I!#e(B

e$B<!$+$i$Oe(B ruby-core e$B$K%l%]!<%H$9$k$h$&$K$7$^$9!#e(B