mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 04:24:04 +02:00
parent
30d2d72663
commit
de96ae9b71
2 changed files with 48 additions and 3 deletions
|
@ -377,7 +377,24 @@ module TestIRB
|
|||
|
||||
def test_ls
|
||||
input = TestInputMethod.new([
|
||||
"ls Object.new.tap { |o| o.instance_variable_set(:@a, 1) }\n",
|
||||
"class C\n",
|
||||
" def m1() end\n",
|
||||
"end\n",
|
||||
|
||||
"module M\n",
|
||||
" def m2() end\n",
|
||||
"end\n",
|
||||
|
||||
"module M2\n",
|
||||
" include M\n",
|
||||
" def m3() end\n",
|
||||
"end\n",
|
||||
|
||||
"obj = C.new\n",
|
||||
"obj.instance_variable_set(:@a, 1)\n",
|
||||
"obj.extend M2\n",
|
||||
"def obj.m4() end\n",
|
||||
"ls obj\n",
|
||||
])
|
||||
IRB.init_config(nil)
|
||||
workspace = IRB::WorkSpace.new(self)
|
||||
|
@ -390,6 +407,10 @@ module TestIRB
|
|||
end
|
||||
assert_empty err
|
||||
assert_match(/^instance variables:\s+@a\n/m, out)
|
||||
assert_match(/C#methods: m1\n/m, out)
|
||||
assert_match(/M#methods: m2\n/m, out)
|
||||
assert_match(/M2#methods: m3\n/m, out)
|
||||
assert_match(/C.methods: m4\n/m, out)
|
||||
end
|
||||
|
||||
def test_show_source
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue