* file.c (rb_f_test): test(0) should not have any special

meaning.  [ruby-dev:29425]

* file.c (rb_f_test): properer error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-09-09 16:19:33 +00:00
Родитель 7d3fc8ff2b
Коммит 0f785c3840
3 изменённых файлов: 19 добавлений и 11 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sat Sep 9 23:55:28 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* file.c (rb_f_test): test(0) should not have any special
meaning. [ruby-dev:29425]
* file.c (rb_f_test): properer error message.
Sat Sep 9 14:08:38 2006 Eric Hodel <drbrain@segment7.net>
* lib/test/unit/testcase.rb (Test::Unit::TestCase#run): Rescue

15
file.c
Просмотреть файл

@ -3248,13 +3248,8 @@ rb_f_test(int argc, VALUE *argv)
int cmd;
if (argc == 0) rb_raise(rb_eArgError, "wrong number of arguments");
#if 0 /* 1.7 behavior? */
if (argc == 1) {
return RTEST(argv[0]) ? Qtrue : Qfalse;
}
#endif
cmd = NUM2CHR(argv[0]);
if (cmd == 0) return Qfalse;
if (cmd == 0) goto unknown;
if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) {
CHECK(1);
switch (cmd) {
@ -3371,8 +3366,14 @@ rb_f_test(int argc, VALUE *argv)
return Qfalse;
}
}
unknown:
/* unknown command */
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
if (ISPRINT(cmd)) {
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
}
else {
rb_raise(rb_eArgError, "unknown command ?\\%03o", cmd);
}
return Qnil; /* not reached */
}

Просмотреть файл

@ -2501,12 +2501,12 @@ rb_str_to_s(VALUE str)
* call-seq:
* str.inspect => string
*
* Returns a printable version of _str_, with special characters
* escaped.
* Returns a printable version of _str_, srrounded by quote marks,
* with special characters escaped.
*
* str = "hello"
* str[3] = 8
* str.inspect #=> "hel\010o"
* str[3] = "\b"
* str.inspect #=> "\"hel\bo\""
*/
VALUE