Permalink
Browse files

* eval.c (make_exception, rb_obj_extend): Fix error messages in case …

…of wrong

  number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
marcandre committed Apr 30, 2010
1 parent f6a5c0f commit 478c3e080b0d2782ae630f87c22d1a8e36756778
Showing with 43 additions and 21 deletions.
  1. +22 −0 ChangeLog
  2. +2 −2 eval.c
  3. +2 −2 file.c
  4. +2 −2 numeric.c
  5. +4 −4 proc.c
  6. +1 −1 process.c
  7. +1 −1 re.c
  8. +2 −2 signal.c
  9. +7 −7 string.c
View
@@ -1,3 +1,25 @@
+Fri Apr 30 11:40:44 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * eval.c (make_exception, rb_obj_extend): Fix error messages in case
+ of wrong
+ number of arguments
+
+ * file.c (rb_f_test, rb_file_s_umask): ditto
+
+ * numeric.c (int_chr, num_step): ditto
+
+ * process.c (rb_f_sleep): ditto
+
+ * re.c (rb_reg_initialize_m): ditto
+
+ * signal.c (rb_f_kill, sig_trap): ditto
+
+ * string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count,
+ rb_str_delete_bang,
+ rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto
+
+ * proc.c (curry): rdoc fix
+
Fri Apr 30 04:09:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* time.c (TIMET_MAX): should be time_t, not unsigned_time_t.
View
4 eval.c
@@ -555,7 +555,7 @@ make_exception(int argc, VALUE *argv, int isstr)
}
break;
default:
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..3)", argc);
break;
}
if (argc > 0) {
@@ -930,7 +930,7 @@ rb_obj_extend(int argc, VALUE *argv, VALUE obj)
int i;
if (argc == 0) {
- rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
+ rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
}
for (i = 0; i < argc; i++)
Check_Type(argv[i], T_MODULE);
View
4 file.c
@@ -2476,7 +2476,7 @@ rb_file_s_umask(int argc, VALUE *argv)
omask = umask(NUM2INT(argv[0]));
}
else {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
}
return INT2FIX(omask);
}
@@ -3962,7 +3962,7 @@ rb_f_test(int argc, VALUE *argv)
{
int cmd;
- if (argc == 0) rb_raise(rb_eArgError, "wrong number of arguments");
+ if (argc == 0) rb_raise(rb_eArgError, "wrong number of arguments (0 for 2..3)");
cmd = NUM2CHR(argv[0]);
if (cmd == 0) goto unknown;
if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) {
View
@@ -1600,7 +1600,7 @@ num_step(int argc, VALUE *argv, VALUE from)
step = argv[1];
}
else {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
if (rb_equal(step, INT2FIX(0))) {
rb_raise(rb_eArgError, "step can't be 0");
@@ -2018,7 +2018,7 @@ int_chr(int argc, VALUE *argv, VALUE num)
case 1:
break;
default:
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 or 1)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
break;
}
enc = rb_to_encoding(argv[0]);
View
8 proc.c
@@ -1967,16 +1967,16 @@ curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
*
* b = lambda {|x, y, z| (x||0) + (y||0) + (z||0) }
* p b.curry[1][2][3] #=> 6
- * p b.curry[1, 2][3, 4] #=> wrong number of arguments (4 or 3)
- * p b.curry(5) #=> wrong number of arguments (5 or 3)
- * p b.curry(1) #=> wrong number of arguments (1 or 3)
+ * p b.curry[1, 2][3, 4] #=> wrong number of arguments (4 for 3)
+ * p b.curry(5) #=> wrong number of arguments (5 for 3)
+ * p b.curry(1) #=> wrong number of arguments (1 for 3)
*
* b = lambda {|x, y, z, *w| (x||0) + (y||0) + (z||0) + w.inject(0, &:+) }
* p b.curry[1][2][3] #=> 6
* p b.curry[1, 2][3, 4] #=> 10
* p b.curry(5)[1][2][3][4][5] #=> 15
* p b.curry(5)[1, 2][3, 4][5] #=> 15
- * p b.curry(1) #=> wrong number of arguments (1 or 3)
+ * p b.curry(1) #=> wrong number of arguments (1 for 3)
*
* b = proc { :foo }
* p b.curry[] #=> :foo
View
@@ -3262,7 +3262,7 @@ rb_f_sleep(int argc, VALUE *argv)
rb_thread_wait_for(rb_time_interval(argv[0]));
}
else {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
}
end = time(0) - beg;
View
2 re.c
@@ -2867,7 +2867,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
long len;
if (argc == 0 || argc > 3) {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..3)", argc);
}
if (TYPE(argv[0]) == T_REGEXP) {
VALUE re = argv[0];
View
@@ -351,7 +351,7 @@ rb_f_kill(int argc, VALUE *argv)
rb_secure(2);
if (argc < 2)
- rb_raise(rb_eArgError, "wrong number of arguments -- kill(sig, pid...)");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for at least 2)", argc);
switch (TYPE(argv[0])) {
case T_FIXNUM:
sig = FIX2INT(argv[0]);
@@ -940,7 +940,7 @@ sig_trap(int argc, VALUE *argv)
rb_secure(2);
if (argc < 1 || argc > 2) {
- rb_raise(rb_eArgError, "wrong number of arguments -- trap(sig, cmd)/trap(sig){...}");
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
arg.sig = trap_signm(argv[0]);
View
@@ -3093,7 +3093,7 @@ rb_str_aref_m(int argc, VALUE *argv, VALUE str)
return rb_str_substr(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]));
}
if (argc != 1) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
return rb_str_aref(str, argv[0]);
}
@@ -3323,7 +3323,7 @@ rb_str_aset_m(int argc, VALUE *argv, VALUE str)
return argv[2];
}
if (argc != 2) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2..3)", argc);
}
return rb_str_aset(str, argv[0], argv[1]);
}
@@ -3388,7 +3388,7 @@ rb_str_slice_bang(int argc, VALUE *argv, VALUE str)
int i;
if (argc < 1 || 2 < argc) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
for (i=0; i<argc; i++) {
buf[i] = argv[i];
@@ -3462,7 +3462,7 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
if (OBJ_UNTRUSTED(repl)) untrusted = 1;
}
else {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
pat = get_pat(argv[0], 1);
@@ -3606,7 +3606,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
if (OBJ_TAINTED(repl)) tainted = 1;
break;
default:
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
}
pat = get_pat(argv[0], 1);
@@ -5066,7 +5066,7 @@ rb_str_delete_bang(int argc, VALUE *argv, VALUE str)
if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
if (argc < 1) {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
}
for (i=0; i<argc; i++) {
VALUE s = argv[i];
@@ -5312,7 +5312,7 @@ rb_str_count(int argc, VALUE *argv, VALUE str)
int ascompat;
if (argc < 1) {
- rb_raise(rb_eArgError, "wrong number of arguments");
+ rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
}
for (i=0; i<argc; i++) {
VALUE tstr = argv[i];

0 comments on commit 478c3e0

Please sign in to comment.