Ruby/Extensions(0.6.0)

Continuation クラスがないので動かない。と、Continuation 以外も拡張しているのだから、Continuation クラスはダミーで作ってテストを実施すればいいことに気づいた。

事前作業

  • lib/_base.rb の VERSION を RUBY_VERSION に修正
  • test/TEST.rb の冒頭で class Continuation;end を追記
date@assam extensions-0.6.0 $ ruby-yarv test/TEST.rb 
Current directory: /home/date/tmp/extensions-0.6.0/test
Loading test file: tc_array.rb
Loading test file: tc_binding.rb
Loading test file: tc_class.rb
Loading test file: tc_continuation.rb
Loading test file: tc_enumerable.rb
Ruby/Extensions: Enumerable#none? is already defined; not overwriting
Ruby/Extensions: Enumerable#one? is already defined; not overwriting
Loading test file: tc_hash.rb
Loading test file: tc_io.rb
Loading test file: tc_kernel.rb
Loading test file: tc_module.rb
Loading test file: tc_numeric.rb
Loading test file: tc_object.rb
Loading test file: tc_ostruct.rb
Loading test file: tc_string.rb
Loading test file: tc_symbol.rb
Loaded suite test/TEST
Started
...Fwarning: Thread.critical is unsupported.  Use Mutex instead.
warning: Thread.critical is unsupported.  Use Mutex instead.
Ewarning: Thread.critical is unsupported.  Use Mutex instead.
warning: Thread.critical is unsupported.  Use Mutex instead.
Ewarning: Thread.critical is unsupported.  Use Mutex instead.
warning: Thread.critical is unsupported.  Use Mutex instead.
F..EE.......................................................FF.....................................
Finished in 0.166552 seconds.

  1) Failure:
test_binding_methods(TC_Binding) [/home/date/tmp/extensions-0.6.0/test/tc_binding.rb:55]:
<["b", "x", "y"]> expected but was
<[]>.

  2) Error:
test_binding_methods_with_of_caller(TC_Binding):
NoMethodError: undefined method `callcc' for Continuation:Class
    /home/date/tmp/extensions-0.6.0/lib/extensions/continuation.rb:63:in `create'
    /home/date/tmp/extensions-0.6.0/lib/extensions/binding.rb:111:in `of_caller'
    /home/date/tmp/extensions-0.6.0/test/tc_binding.rb:73:in `_target'
    /home/date/tmp/extensions-0.6.0/test/tc_binding.rb:66:in `test_binding_methods_with_of_caller'

  3) Error:
test_of_caller(TC_Binding_of_caller):
NoMethodError: undefined method `callcc' for Continuation:Class
    /home/date/tmp/extensions-0.6.0/lib/extensions/continuation.rb:63:in `create'
    /home/date/tmp/extensions-0.6.0/lib/extensions/binding.rb:111:in `of_caller'
    /home/date/tmp/extensions-0.6.0/test/tc_binding.rb:30:in `_foo'
    /home/date/tmp/extensions-0.6.0/test/tc_binding.rb:13:in `test_of_caller'

  4) Failure:
test_of_caller_exception(TC_Binding_of_caller) [/home/date/tmp/extensions-0.6.0/test/tc_binding.rb:22]:
<Exception> exception expected but was
Class: <NoMethodError>
Message: <"undefined method `callcc' for Continuation:Class">
---Backtrace---
/home/date/tmp/extensions-0.6.0/lib/extensions/continuation.rb:63:in `create'
/home/date/tmp/extensions-0.6.0/lib/extensions/binding.rb:111:in `of_caller'
/home/date/tmp/extensions-0.6.0/test/tc_binding.rb:37:in `_bar'
/home/date/tmp/extensions-0.6.0/test/tc_binding.rb:23:in `block in test_of_caller_exception'
/home/date/tmp/extensions-0.6.0/test/tc_binding.rb:22:in `test_of_caller_exception'
---------------

  5) Error:
test_cc_inject(TC_Continuation):
NoMethodError: undefined method `callcc' for Continuation:Class
    /home/date/tmp/extensions-0.6.0/lib/extensions/continuation.rb:63:in `create'
    /home/date/tmp/extensions-0.6.0/test/tc_continuation.rb:27:in `cc_inject'
    /home/date/tmp/extensions-0.6.0/test/tc_continuation.rb:19:in `test_cc_inject'

  6) Error:
test_counter(TC_Continuation):
NoMethodError: undefined method `callcc' for Continuation:Class
    /home/date/tmp/extensions-0.6.0/lib/extensions/continuation.rb:63:in `create'
    /home/date/tmp/extensions-0.6.0/test/tc_continuation.rb:9:in `test_counter'

  7) Failure:
test_define_method_0(TC_Object) [/home/date/tmp/extensions-0.6.0/test/tc_object.rb:51]:
<ArgumentError> exception expected but was
Class: <NoMethodError>
Message: <"undefined method `+' for nil:NilClass">
---Backtrace---
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:48:in `block in test_define_method_0'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:51:in `call'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:51:in `block in test_define_method_0'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:51:in `test_define_method_0'
---------------

  8) Failure:
test_define_method_1(TC_Object) [/home/date/tmp/extensions-0.6.0/test/tc_object.rb:61]:
<ArgumentError> exception expected but was
Class: <NoMethodError>
Message: <"super: no superclass method `coerce'">
---Backtrace---
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:58:in `+'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:58:in `block in test_define_method_1'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:61:in `call'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:61:in `block in test_define_method_1'
/home/date/tmp/extensions-0.6.0/test/tc_object.rb:61:in `test_define_method_1'
---------------

105 tests, 970 assertions, 4 failures, 4 errors

割と成績が良い。callcc 以外の問題点は後で詳しく調べる。