mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rubyspec: Fix method redefinition warning
ruby/spec/rubyspec/library/erb/run_spec.rb:63: warning: method redefined; discarding old main ruby/spec/rubyspec/library/erb/result_spec.rb:53: warning: previous definition of main was here ruby/spec/rubyspec/library/erb/run_spec.rb:76: warning: method redefined; discarding old main1 ruby/spec/rubyspec/library/erb/result_spec.rb:67: warning: previous definition of main1 was here ruby/spec/rubyspec/library/erb/run_spec.rb:81: warning: method redefined; discarding old main2 ruby/spec/rubyspec/library/erb/result_spec.rb:72: warning: previous definition of main2 was here git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
26e32b7d65
commit
fc7241ffe2
2 changed files with 10 additions and 10 deletions
|
@ -48,7 +48,7 @@ END
|
||||||
|
|
||||||
|
|
||||||
it "is able to h() or u() if ERB::Util is included" do
|
it "is able to h() or u() if ERB::Util is included" do
|
||||||
class MyERB1
|
myerb1 = Class.new do
|
||||||
include ERB::Util
|
include ERB::Util
|
||||||
def main
|
def main
|
||||||
input = "<%=h '<>' %>"
|
input = "<%=h '<>' %>"
|
||||||
|
@ -56,13 +56,13 @@ END
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
expected = '<>'
|
expected = '<>'
|
||||||
actual = MyERB1.new.main()
|
actual = myerb1.new.main()
|
||||||
actual.should == expected
|
actual.should == expected
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
it "use TOPLEVEL_BINDING if binding is not passed" do
|
it "use TOPLEVEL_BINDING if binding is not passed" do
|
||||||
class MyERB2
|
myerb2 = Class.new do
|
||||||
include ERB::Util
|
include ERB::Util
|
||||||
def main1
|
def main1
|
||||||
#input = "<%= binding.to_s %>"
|
#input = "<%= binding.to_s %>"
|
||||||
|
@ -77,10 +77,10 @@ END
|
||||||
|
|
||||||
eval '_xxx_var_ = 123', TOPLEVEL_BINDING
|
eval '_xxx_var_ = 123', TOPLEVEL_BINDING
|
||||||
expected = '123'
|
expected = '123'
|
||||||
MyERB2.new.main1().should == expected
|
myerb2.new.main1().should == expected
|
||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
MyERB2.new.main2()
|
myerb2.new.main2()
|
||||||
}.should raise_error(NameError)
|
}.should raise_error(NameError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,7 +58,7 @@ END
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is able to h() or u() if ERB::Util is included" do
|
it "is able to h() or u() if ERB::Util is included" do
|
||||||
class MyERB1
|
myerb1 = Class.new do
|
||||||
include ERB::Util
|
include ERB::Util
|
||||||
def main
|
def main
|
||||||
input = "<%=h '<>' %>"
|
input = "<%=h '<>' %>"
|
||||||
|
@ -66,12 +66,12 @@ END
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
expected = '<>'
|
expected = '<>'
|
||||||
actual = _steal_stdout { MyERB1.new.main() }
|
actual = _steal_stdout { myerb1.new.main() }
|
||||||
actual.should == expected
|
actual.should == expected
|
||||||
end
|
end
|
||||||
|
|
||||||
it "use TOPLEVEL_BINDING if binding is not passed" do
|
it "use TOPLEVEL_BINDING if binding is not passed" do
|
||||||
class MyERB2
|
myerb2 = Class.new do
|
||||||
include ERB::Util
|
include ERB::Util
|
||||||
def main1
|
def main1
|
||||||
#input = "<%= binding.to_s %>"
|
#input = "<%= binding.to_s %>"
|
||||||
|
@ -86,11 +86,11 @@ END
|
||||||
|
|
||||||
eval '_xxx_var_ = 123', TOPLEVEL_BINDING
|
eval '_xxx_var_ = 123', TOPLEVEL_BINDING
|
||||||
expected = '123'
|
expected = '123'
|
||||||
actual = _steal_stdout { MyERB2.new.main1() }
|
actual = _steal_stdout { myerb2.new.main1() }
|
||||||
actual.should == expected
|
actual.should == expected
|
||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
_steal_stdout { MyERB2.new.main2() }
|
_steal_stdout { myerb2.new.main2() }
|
||||||
}.should raise_error(NameError)
|
}.should raise_error(NameError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue