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

ruby-changes:67999

From: Olle <ko1@a...>
Date: Wed, 15 Sep 2021 16:20:29 +0900 (JST)
Subject: [ruby-changes:67999] 645acf5771 (master): [ruby/racc] Prefer __dir__ over File.dirname(__FILE__)

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

From 645acf5771dccdae7791c8e1e24a43ad350a3594 Mon Sep 17 00:00:00 2001
From: Olle Jonsson <olle.jonsson@a...>
Date: Tue, 14 Sep 2021 14:38:11 +0200
Subject: [ruby/racc] Prefer __dir__ over File.dirname(__FILE__)

https://github.com/ruby/racc/commit/c49df40658
---
 test/racc/assets/mof.y                | 6 +++---
 test/racc/case.rb                     | 2 +-
 test/racc/regress/mof                 | 6 +++---
 test/racc/test_chk_y.rb               | 2 +-
 test/racc/test_grammar_file_parser.rb | 2 +-
 test/racc/test_racc_command.rb        | 2 +-
 test/racc/test_scan_y.rb              | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/test/racc/assets/mof.y b/test/racc/assets/mof.y
index b241f74..2e83c79 100644
--- a/test/racc/assets/mof.y
+++ b/test/racc/assets/mof.y
@@ -563,9 +563,9 @@ end # class Parser https://github.com/ruby/ruby/blob/trunk/test/racc/assets/mof.y#L563
 require 'strscan'
 require 'rubygems'
 require 'cim'
-require File.join(File.dirname(__FILE__), 'result')
-require File.join(File.dirname(__FILE__), 'scanner')
-require File.join(File.dirname(__FILE__), 'case')
+require File.join(__dir__, 'result')
+require File.join(__dir__, 'scanner')
+require File.join(__dir__, 'case')
 
 ---- inner ----
 
diff --git a/test/racc/case.rb b/test/racc/case.rb
index d5f9dad..f4240bf 100644
--- a/test/racc/case.rb
+++ b/test/racc/case.rb
@@ -10,7 +10,7 @@ require 'timeout' https://github.com/ruby/ruby/blob/trunk/test/racc/case.rb#L10
 
 module Racc
   class TestCase < Test::Unit::TestCase
-    PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+    PROJECT_DIR = File.expand_path(File.join(__dir__, '..'))
 
     test_dir = File.join(PROJECT_DIR, 'test')
     test_dir = File.join(PROJECT_DIR, 'racc') unless File.exist?(test_dir)
diff --git a/test/racc/regress/mof b/test/racc/regress/mof
index 614bcc0..d702292 100644
--- a/test/racc/regress/mof
+++ b/test/racc/regress/mof
@@ -12,9 +12,9 @@ require 'racc/parser.rb' https://github.com/ruby/ruby/blob/trunk/test/racc/regress/mof#L12
 require 'strscan'
 require 'rubygems'
 require 'cim'
-require File.join(File.dirname(__FILE__), 'result')
-require File.join(File.dirname(__FILE__), 'scanner')
-require File.join(File.dirname(__FILE__), 'case')
+require File.join(__dir__, 'result')
+require File.join(__dir__, 'scanner')
+require File.join(__dir__, 'case')
 
 module MOF
   class Parser < Racc::Parser
diff --git a/test/racc/test_chk_y.rb b/test/racc/test_chk_y.rb
index dfe5b09..883737c 100644
--- a/test/racc/test_chk_y.rb
+++ b/test/racc/test_chk_y.rb
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/racc/test_chk_y.rb#L1
-require File.expand_path(File.join(File.dirname(__FILE__), 'case'))
+require File.expand_path(File.join(__dir__, 'case'))
 
 module Racc
   class TestChkY < TestCase
diff --git a/test/racc/test_grammar_file_parser.rb b/test/racc/test_grammar_file_parser.rb
index ddfc017..8f6e090 100644
--- a/test/racc/test_grammar_file_parser.rb
+++ b/test/racc/test_grammar_file_parser.rb
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/racc/test_grammar_file_parser.rb#L1
-require File.expand_path(File.join(File.dirname(__FILE__), 'case'))
+require File.expand_path(File.join(__dir__, 'case'))
 
 module Racc
   class TestGrammarFileParser < TestCase
diff --git a/test/racc/test_racc_command.rb b/test/racc/test_racc_command.rb
index 77c57a3..5bfebf1 100644
--- a/test/racc/test_racc_command.rb
+++ b/test/racc/test_racc_command.rb
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/racc/test_racc_command.rb#L1
-require File.expand_path(File.join(File.dirname(__FILE__), 'case'))
+require File.expand_path(File.join(__dir__, 'case'))
 
 module Racc
   class TestRaccCommand < TestCase
diff --git a/test/racc/test_scan_y.rb b/test/racc/test_scan_y.rb
index 983e2f5..fcd7e53 100644
--- a/test/racc/test_scan_y.rb
+++ b/test/racc/test_scan_y.rb
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/racc/test_scan_y.rb#L1
-require File.expand_path(File.join(File.dirname(__FILE__), 'case'))
+require File.expand_path(File.join(__dir__, 'case'))
 
 module Racc
   class TestScanY < TestCase
-- 
cgit v1.1


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

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