Skip to content

Commit

Permalink
Added lib path to in assert_in_out_err
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jan 9, 2025
1 parent b2c481c commit 9cb9f1c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/logger/test_logdevice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def stat
end

def setup
@top_dir = File.expand_path('../../lib', __dir__)
@tempfile = Tempfile.new("logger")
@tempfile.close
@filename = @tempfile.path
Expand Down Expand Up @@ -456,7 +457,7 @@ def test_shifting_size_not_rotate_too_much

def test_shifting_midnight
Dir.mktmpdir do |tmpdir|
assert_in_out_err([*%W"--disable=gems -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([*%W"--disable=gems -I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -498,7 +499,7 @@ class << Time

def test_shifting_weekly
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -543,7 +544,7 @@ class << Time

def test_shifting_monthly
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -588,7 +589,7 @@ class << Time

def test_shifting_dst_change
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"Europe/London"}, *%W"--disable=gems -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"Europe/London"}, *%W"--disable=gems -I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -707,7 +708,7 @@ class << Time

def test_shifting_midnight_exist_file
Dir.mktmpdir do |tmpdir|
assert_in_out_err([*%W"--disable=gems -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([*%W"--disable=gems -I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -751,7 +752,7 @@ class << Time

def test_shifting_weekly_exist_file
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -798,7 +799,7 @@ class << Time

def test_shifting_monthly_exist_file
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -848,7 +849,7 @@ class << Time
def run_children(n, args, src)
r, w = IO.pipe
[w, *(1..n).map do
f = IO.popen([EnvUtil.rubybin, *%w[--disable=gems -rlogger -], *args], "w", err: w)
f = IO.popen([EnvUtil.rubybin, *%w[--disable=gems -I#{@top_lovel} -rlogger -], *args], "w", err: w)
f.puts(src)
f
end].each(&:close)
Expand Down

0 comments on commit 9cb9f1c

Please sign in to comment.