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

ruby-changes:62621

From: aycabta <ko1@a...>
Date: Tue, 18 Aug 2020 19:16:04 +0900 (JST)
Subject: [ruby-changes:62621] f0e6ecec65 (master): [ruby/reline] Use temporary dir with yamatanooroti test

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

From f0e6ecec65229050e5c9a6010e09546e9773090d Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 5 Jul 2020 14:02:34 +0900
Subject: [ruby/reline] Use temporary dir with yamatanooroti test

https://github.com/ruby/reline/commit/8d7df88e98

diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 907ad58..329fce4 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -5,13 +5,28 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L5
 
   class Reline::TestRendering < Yamatanooroti::TestCase
     def setup
+      @pwd = Dir.pwd
+      @tmpdir = File.join(Dir.tmpdir, "test_reline_config_#{$$}")
+      begin
+        Dir.mkdir(@tmpdir)
+      rescue Errno::EEXIST
+        FileUtils.rm_rf(@tmpdir)
+        Dir.mkdir(@tmpdir)
+      end
+      Dir.chdir(@tmpdir)
       inputrc_backup = ENV['INPUTRC']
-      ENV['INPUTRC'] = 'nonexistent_file'
-      start_terminal(5, 30, %w{ruby -Ilib bin/multiline_repl})
+      @inputrc_file = ENV['INPUTRC'] = File.expand_path('temporaty_inputrc')
+      File.unlink(@inputrc_file) if File.exist?(@inputrc_file)
+      start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl})
       sleep 0.5
       ENV['INPUTRC'] = inputrc_backup
     end
 
+    def teardown
+      Dir.chdir(@pwd)
+      FileUtils.rm_rf(@tmpdir)
+    end
+
     def test_history_back
       write(":a\n")
       write("\C-p")
-- 
cgit v0.10.2


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

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