[前][次][番号順一覧][スレッド一覧]

ruby-changes:60672

From: Nobuyoshi <ko1@a...>
Date: Mon, 6 Apr 2020 21:44:12 +0900 (JST)
Subject: [ruby-changes:60672] a58bbd6a51 (master): Use `rb_warn_deprecated` for `File.exists?` and `Dir.exists?`

https://git.ruby-lang.org/ruby.git/commit/?id=a58bbd6a51

From a58bbd6a512d95ca010d8bebae4fe590400c1413 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 6 Apr 2020 21:37:42 +0900
Subject: Use `rb_warn_deprecated` for `File.exists?` and `Dir.exists?`


diff --git a/dir.c b/dir.c
index 5013b9b..5bd4ff4 100644
--- a/dir.c
+++ b/dir.c
@@ -3498,7 +3498,7 @@ rb_file_directory_p(void) https://github.com/ruby/ruby/blob/trunk/dir.c#L3498
 static VALUE
 rb_dir_exists_p(VALUE obj, VALUE fname)
 {
-    rb_warning("Dir.exists? is a deprecated name, use Dir.exist? instead");
+    rb_warn_deprecated("", "Dir.exist?");
     return rb_file_directory_p(obj, fname);
 }
 
diff --git a/file.c b/file.c
index c267781..929dac8 100644
--- a/file.c
+++ b/file.c
@@ -1782,16 +1782,16 @@ rb_file_exist_p(VALUE obj, VALUE fname) https://github.com/ruby/ruby/blob/trunk/file.c#L1782
 static VALUE
 rb_file_exists_p(VALUE obj, VALUE fname)
 {
-    const char *s = "FileTest#";
+    const char *s = "FileTest#exist?";
     if (obj == rb_mFileTest) {
-	s = "FileTest.";
+	s = "FileTest.exist?";
     }
     else if (obj == rb_cFile ||
 	     (RB_TYPE_P(obj, T_CLASS) &&
 	      RTEST(rb_class_inherited_p(obj, rb_cFile)))) {
-	s = "File.";
+	s = "File.exist?";
     }
-    rb_warning("%sexists? is a deprecated name, use %sexist? instead", s, s);
+    rb_warn_deprecated("", s);
     return rb_file_exist_p(obj, fname);
 }
 
diff --git a/spec/ruby/core/dir/exists_spec.rb b/spec/ruby/core/dir/exists_spec.rb
deleted file mode 100644
index 2c6f145..0000000
--- a/spec/ruby/core/dir/exists_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/file.c#L0
-require_relative '../../spec_helper'
-require_relative 'fixtures/common'
-require_relative 'shared/exist'
-
-describe "Dir.exists?" do
-  before :all do
-    DirSpecs.create_mock_dirs
-  end
-
-  after :all do
-    DirSpecs.delete_mock_dirs
-  end
-
-  it_behaves_like :dir_exist, :exists?
-end
diff --git a/spec/ruby/core/file/exists_spec.rb b/spec/ruby/core/file/exists_spec.rb
deleted file mode 100644
index 31d0e4d..0000000
--- a/spec/ruby/core/file/exists_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/file.c#L0
-require_relative '../../spec_helper'
-require_relative '../../shared/file/exist'
-
-describe "File.exists?" do
-  it_behaves_like :file_exist, :exists?, File
-end
diff --git a/spec/ruby/core/filetest/exists_spec.rb b/spec/ruby/core/filetest/exists_spec.rb
deleted file mode 100644
index d090d7d..0000000
--- a/spec/ruby/core/filetest/exists_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/file.c#L0
-require_relative '../../spec_helper'
-require_relative '../../shared/file/exist'
-
-describe "FileTest.exists?" do
-  it_behaves_like :file_exist, :exists?, FileTest
-end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]