mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
irb: Define extension command only on the given object
Not to interfer in class variables.
This commit is contained in:
parent
0fad9a9e30
commit
feea436feb
2 changed files with 5 additions and 3 deletions
|
@ -170,13 +170,15 @@ module TestIRB
|
|||
"measure :off\n",
|
||||
"3\n",
|
||||
])
|
||||
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input)
|
||||
c = Class.new(Object)
|
||||
irb = IRB::Irb.new(IRB::WorkSpace.new(c.new), input)
|
||||
irb.context.return_format = "=> %s\n"
|
||||
out, err = capture_output do
|
||||
irb.eval_input
|
||||
end
|
||||
assert_empty err
|
||||
assert_match(/\A=> 3\nTIME is added\.\n=> nil\nprocessing time: .+\n=> 3\n=> nil\n=> 3\n/, out)
|
||||
assert_empty(c.class_variables)
|
||||
end
|
||||
|
||||
def test_measure_enabled_by_rc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue