Skip to content

Commit

Permalink
add test for removing constants that are already removed
Browse files Browse the repository at this point in the history
  • Loading branch information
genkami committed Jul 12, 2019
1 parent 8542c62 commit e68a909
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions padrino-core/test/fixtures/dependencies/gc/t.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Padrino.require_dependencies(
Padrino.root("fixtures/dependencies/gc/v.rb"),
Padrino.root("fixtures/dependencies/gc/w.rb"),
Padrino.root("fixtures/dependencies/gc/x.rb")
)
3 changes: 3 additions & 0 deletions padrino-core/test/fixtures/dependencies/gc/u.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Padrino.require_dependencies(
Padrino.root("fixtures/dependencies/gc/y.rb")
)
10 changes: 10 additions & 0 deletions padrino-core/test/fixtures/dependencies/gc/v.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class V
$prevent_from_being_gced ||= []
$prevent_from_being_gced.push(self)

def self.hello
"hello"
end

W
end
2 changes: 2 additions & 0 deletions padrino-core/test/fixtures/dependencies/gc/w.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class W
end
2 changes: 2 additions & 0 deletions padrino-core/test/fixtures/dependencies/gc/x.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class X < Y
end
2 changes: 2 additions & 0 deletions padrino-core/test/fixtures/dependencies/gc/y.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Y
end
10 changes: 10 additions & 0 deletions padrino-core/test/test_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
assert_equal "hello", M.hello
end

it 'should not remove constants that are already `remove_const`ed' do
capture_io do
Padrino.require_dependencies(
Padrino.root("fixtures/dependencies/gc/t.rb"),
Padrino.root("fixtures/dependencies/gc/u.rb")
)
end
assert_equal "hello", V.hello
end


describe "change log level for :devel" do
before do
Expand Down

0 comments on commit e68a909

Please sign in to comment.