Skip to content

Commit

Permalink
Reword and reorder logging test
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed May 26, 2024
1 parent 5c67e65 commit ba26886
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/lib/zeitwerk/test_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@ def logger.debug(message)
end
end

test "logs files shadowed by already defined constants" do
on_teardown { remove_const :X }

::X = 1
files = [["x.rb", "X = 1"]]
with_files(files) do
loader.push_dir(".")
assert_logged(%r(file .*?/x\.rb is ignored because X is already defined)) do
loader.setup
end
end
end

test "logs when eager loading starts" do
with_setup do
assert_logged(/eager load start/) do
Expand All @@ -206,17 +219,4 @@ def logger.debug(message)
end
end
end

test "eager loading skips files that would map to already loaded constants" do
on_teardown { remove_const :X }

::X = 1
files = [["x.rb", "X = 1"]]
with_files(files) do
loader.push_dir(".")
assert_logged(%r(file .*?/x\.rb is ignored because X is already defined)) do
loader.setup
end
end
end
end

0 comments on commit ba26886

Please sign in to comment.