Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

interp_send should return TCL_OK, not TCL_RETURN

git-svn-id: svn://rubyforge.org/var/svn/tcl/trunk@12 017b7ecb-b1d0-4998-98d6-e9014aaf4887
  • Loading branch information...
commit c9868486a64f04c282fec50c630b245a554e7ddc 1 parent a70040b
@sstephenson sstephenson authored
Showing with 7 additions and 3 deletions.
  1. +3 −3 src/tcl.c
  2. +4 −0 test/interp_receive_test.rb
View
6 src/tcl.c
@@ -19,7 +19,7 @@ static VALUE rb_tcl_interp_send_begin(VALUE args) {
VALUE obj = rb_ary_entry(args, 0);
VALUE interp_receive_args = rb_ary_entry(args, 1);
- VALUE result = rb_funcall2(obj, rb_intern("interp_receive"), RARRAY_LEN(interp_receive_args), RARRAY_PTR(interp_receive_args));
+ VALUE result = rb_funcall2(obj, rb_intern("interp_receive"), RARRAY(interp_receive_args)->len, RARRAY(interp_receive_args)->ptr);
tcl_interp_struct *tcl_interp;
Data_Get_Struct(obj, tcl_interp_struct, tcl_interp);
@@ -56,7 +56,7 @@ static int rb_tcl_interp_send(ClientData clientData, Tcl_Interp *interp, int obj
VALUE args = rb_ary_new3(2, (VALUE) clientData, interp_receive_args);
if (rb_rescue2(rb_tcl_interp_send_begin, args, rb_tcl_interp_send_rescue, args, rb_eException) == Qtrue) {
- return TCL_RETURN;
+ return TCL_OK;
} else {
return TCL_ERROR;
}
@@ -142,7 +142,7 @@ static VALUE rb_tcl_interp_array_to_list(VALUE self, VALUE array) {
tcl_interp_struct *tcl_interp;
Data_Get_Struct(self, tcl_interp_struct, tcl_interp);
- int array_length = NUM2INT(rb_funcall(array, rb_intern("length"), 0, 0)), i;
+ int array_length = RARRAY(array)->len, i;
Tcl_Obj *list = Tcl_NewObj();
Tcl_IncrRefCount(list);
View
4 test/interp_receive_test.rb
@@ -53,6 +53,10 @@ def test_interp_send_with_no_arguments_should_raise
assert_raises(Tcl::Error) { @interp.eval("interp_send") }
end
+ def test_interp_send_returns_tcl_ok
+ assert_equal "0", @interp.eval("catch {interp_send no_arguments}")
+ end
+
def test_interp_send_to_method_with_no_arguments
assert_equal "hello", @interp.eval("interp_send no_arguments")
assert_raises(Tcl::Error) { @interp.eval("interp_send no_arguments foo") }
Please sign in to comment.
Something went wrong with that request. Please try again.