[#48190] [ruby-trunk - Feature #9816] 文字列内の数字を数値として比較するメソッド — zn@...
Issue #9816 has been updated by Kazuhiro NISHIYAMA.
3 messages
2014/05/08
[ruby-dev:48172] Kenel.test('a')
From:
Tadayoshi Funaba <tadf@...>
Date:
2014-05-05 04:38:01 UTC
List:
ruby-dev #48172
test に 'e' コマンドと同じ効果として 'a' のエントリがありますが前段階の
チェックで実際には機能しません。
これは有効にしたほうがいいのか、エントリを削除したほうがいいのか、どっ
ちでしょうか。bash の builtin などにはあるようですが。
Index: file.c
===================================================================
--- file.c (リビジョン 45822)
+++ file.c (作業コピー)
@@ -4527,6 +4527,7 @@
* File tests on a single file:
*
* Cmd Returns Meaning
+ * "a" | boolean | True if file1 exists
* "A" | Time | Last access time for file1
* "b" | boolean | True if file1 is a block device
* "c" | boolean | True if file1 is a character device
@@ -4592,7 +4593,7 @@
rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd);
}
}
- if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) {
+ if (strchr("bcdaefgGkloOprRsSuwWxXz", cmd)) {
CHECK(1);
switch (cmd) {
case 'b':
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb (リビジョン 45822)
+++ test/ruby/test_file_exhaustive.rb (作業コピー)
@@ -942,6 +942,7 @@
assert_equal(File.blockdev?(f), test(?b, f))
assert_equal(File.chardev?(f), test(?c, f))
assert_equal(File.directory?(f), test(?d, f))
+ assert_equal(File.exist?(f), test(?a, f))
assert_equal(File.exist?(f), test(?e, f))
assert_equal(File.file?(f), test(?f, f))
assert_equal(File.setgid?(f), test(?g, f))