Forum: Ruby-dev r19789 * transcode.c / test/ruby/test_transcode.rb

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
TAKANO Mitsuhiro (Guest)
on 2008-10-15 11:43
(Received via mailing list)
高野です。

以下のFailについてです。
---
4) Failure:
test_errors(TestTranscode)
[/home/takano/ruby/test/fileutils/fileasserts.rb:8:in `_wrap_assertion'
/home/takano/ruby/test/fileutils/fileasserts.rb:8:in `_wrap_assertion'
/home/takano/ruby/test/ruby/test_transcode.rb:22:in `test_errors']:
<ArgumentError> exception expected but none was thrown.
---

22行目はこんな感じです。
---
assert_raise(ArgumentError) { 'abc'.encode }
assert_raise(ArgumentError) { 'abc'.encode! }
---

encode と encode! の引数のテストをしているようです。
どうやら無引数の呼び出しは許可していないようなので、
transcode.c のとこで str_encode と str_encode_bang 
のところをいじり、
rb_scan_args 
で引数の数をチェックするようにしたら通りました〜。

パッチを添付します。
# 
深く読めてないところがあるかもしれないので、査読希望です 
:-)
Shugo M. (Guest)
on 2008-10-15 12:39
(Received via mailing list)
$BA0ED$G$9!#(B

2008/10/15 16:42 TAKANO Mitsuhiro <removed_email_address@domain.invalid>:
> encode $B$H(B encode! $B$N0z?t$N%F%9%H$r$7$F$$$k$h$&$G$9!#(B
> $B$I$&$d$iL50z?t$N8F$S=P$7$O5v2D$7$F$$$J$$$h$&$J$N$G!"(B
> transcode.c $B$N$H$3$G(B str_encode $B$H(B str_encode_bang $B$N$H$3$m$r$$$8$j!"(B
> rb_scan_args $B$G0z?t$N?t$r%A%'%C%/$9$k$h$&$K$7$?$iDL$j$^$7$?!A!#(B

$B0U?^$5$l$?;EMMJQ99$G$O$J$$$G$7$g$&$+(B?

Mon Oct 13 07:42:57 2008  Yukihiro M.  <removed_email_address@domain.invalid>

       * transcode.c (str_transcode0): String#encode() with no encoding
         specified transcode the string into Encoding.default_internal.
         inspired by [ruby-core:19298].
TAKANO Mitsuhiro (Guest)
on 2008-10-15 13:06
(Received via mailing list)
$B9bLn$G$9!#(B

$B$&$.$c$C!#(B

$B$G$O!"$3$N$U$?$D$N%F%9%H$OC1=c$K>C$7$F$7$^$&$@$1$G$h$5$=$&$G$9$M!#(B

assert_raise(ArgumentError) { 'abc'.encode }
assert_raise(ArgumentError) { 'abc'.encode! }



Shugo M. $B$5$s$O=q$-$^$7$?(B:
This topic is locked and can not be replied to.