summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 18:25:39 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 18:26:38 +0900
commitfeea436febb50eb4265bd985a550e384c606122c (patch)
tree1acf7c2490eea2a0bf6ca6a237e0a1dcb7f49dba /test/irb
parent0fad9a9e30d3dd362d9567284284206e1a476920 (diff)
irb: Define extension command only on the given object
Not to interfer in class variables.
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_cmd.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb
index 699c9cd..55549d0 100644
--- a/test/irb/test_cmd.rb
+++ b/test/irb/test_cmd.rb
@@ -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