* file.c (rb_f_test): use string form in unknown command error

message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-12-07 18:51:42 +00:00
parent f3b8aa1a60
commit 3512a38d3b
2 changed files with 36 additions and 31 deletions

View File

@ -1,3 +1,8 @@
Tue Dec 8 03:50:24 2009 Tanaka Akira <akr@fsij.org>
* file.c (rb_f_test): use string form in unknown command error
message.
Mon Dec 7 14:11:08 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Dec 7 14:11:08 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (w_object): reverted r26007. [ruby-dev:39845] * marshal.c (w_object): reverted r26007. [ruby-dev:39845]

62
file.c
View File

@ -3680,51 +3680,51 @@ test_check(int n, int argc, VALUE *argv)
* File tests on a single file: * File tests on a single file:
* *
* Test Returns Meaning * Test Returns Meaning
* ?A | Time | Last access time for file1 * "A" | Time | Last access time for file1
* ?b | boolean | True if file1 is a block device * "b" | boolean | True if file1 is a block device
* ?c | boolean | True if file1 is a character device * "c" | boolean | True if file1 is a character device
* ?C | Time | Last change time for file1 * "C" | Time | Last change time for file1
* ?d | boolean | True if file1 exists and is a directory * "d" | boolean | True if file1 exists and is a directory
* ?e | boolean | True if file1 exists * "e" | boolean | True if file1 exists
* ?f | boolean | True if file1 exists and is a regular file * "f" | boolean | True if file1 exists and is a regular file
* ?g | boolean | True if file1 has the \CF{setgid} bit * "g" | boolean | True if file1 has the \CF{setgid} bit
* | | set (false under NT) * | | set (false under NT)
* ?G | boolean | True if file1 exists and has a group * "G" | boolean | True if file1 exists and has a group
* | | ownership equal to the caller's group * | | ownership equal to the caller's group
* ?k | boolean | True if file1 exists and has the sticky bit set * "k" | boolean | True if file1 exists and has the sticky bit set
* ?l | boolean | True if file1 exists and is a symbolic link * "l" | boolean | True if file1 exists and is a symbolic link
* ?M | Time | Last modification time for file1 * "M" | Time | Last modification time for file1
* ?o | boolean | True if file1 exists and is owned by * "o" | boolean | True if file1 exists and is owned by
* | | the caller's effective uid * | | the caller's effective uid
* ?O | boolean | True if file1 exists and is owned by * "O" | boolean | True if file1 exists and is owned by
* | | the caller's real uid * | | the caller's real uid
* ?p | boolean | True if file1 exists and is a fifo * "p" | boolean | True if file1 exists and is a fifo
* ?r | boolean | True if file1 is readable by the effective * "r" | boolean | True if file1 is readable by the effective
* | | uid/gid of the caller * | | uid/gid of the caller
* ?R | boolean | True if file is readable by the real * "R" | boolean | True if file is readable by the real
* | | uid/gid of the caller * | | uid/gid of the caller
* ?s | int/nil | If file1 has nonzero size, return the size, * "s" | int/nil | If file1 has nonzero size, return the size,
* | | otherwise return nil * | | otherwise return nil
* ?S | boolean | True if file1 exists and is a socket * "S" | boolean | True if file1 exists and is a socket
* ?u | boolean | True if file1 has the setuid bit set * "u" | boolean | True if file1 has the setuid bit set
* ?w | boolean | True if file1 exists and is writable by * "w" | boolean | True if file1 exists and is writable by
* | | the effective uid/gid * | | the effective uid/gid
* ?W | boolean | True if file1 exists and is writable by * "W" | boolean | True if file1 exists and is writable by
* | | the real uid/gid * | | the real uid/gid
* ?x | boolean | True if file1 exists and is executable by * "x" | boolean | True if file1 exists and is executable by
* | | the effective uid/gid * | | the effective uid/gid
* ?X | boolean | True if file1 exists and is executable by * "X" | boolean | True if file1 exists and is executable by
* | | the real uid/gid * | | the real uid/gid
* ?z | boolean | True if file1 exists and has a zero length * "z" | boolean | True if file1 exists and has a zero length
* *
* Tests that take two files: * Tests that take two files:
* *
* ?- | boolean | True if file1 and file2 are identical * "-" | boolean | True if file1 and file2 are identical
* ?= | boolean | True if the modification times of file1 * "=" | boolean | True if the modification times of file1
* | | and file2 are equal * | | and file2 are equal
* ?< | boolean | True if the modification time of file1 * "<" | boolean | True if the modification time of file1
* | | is prior to that of file2 * | | is prior to that of file2
* ?> | boolean | True if the modification time of file1 * ">" | boolean | True if the modification time of file1
* | | is after that of file2 * | | is after that of file2
*/ */
@ -3857,10 +3857,10 @@ rb_f_test(int argc, VALUE *argv)
unknown: unknown:
/* unknown command */ /* unknown command */
if (ISPRINT(cmd)) { if (ISPRINT(cmd)) {
rb_raise(rb_eArgError, "unknown command ?%c", cmd); rb_raise(rb_eArgError, "unknown command '%s%c'", cmd == '\'' || cmd == '\\' ? "\\" : "", cmd);
} }
else { else {
rb_raise(rb_eArgError, "unknown command ?\\x%02X", cmd); rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd);
} }
return Qnil; /* not reached */ return Qnil; /* not reached */
} }