File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ require "tempfile"
2+ require_relative "../helper"
3+
4+ module TestIRB
5+ class LSTest < IntegrationTestCase
6+ def setup
7+ super
8+
9+ write_ruby <<~'RUBY'
10+ class Foo
11+ class Bar
12+ def bar
13+ "this is bar"
14+ end
15+ end
16+
17+ def foo
18+ "this is foo"
19+ end
20+ end
21+
22+ class BO < BasicObject
23+ ONE = 1
24+ def baz
25+ "this is baz"
26+ end
27+ end
28+
29+ binding.irb
30+ RUBY
31+ end
32+
33+ def test_ls_class
34+ out = run_ruby_file do
35+ type "ls Foo"
36+ type "exit"
37+ end
38+
39+ assert_match ( /constants: Bar/ , out )
40+ assert_match ( /Foo#methods: foo/ , out )
41+ end
42+
43+ def test_ls_instance
44+ out = run_ruby_file do
45+ type "ls Foo.new"
46+ type "exit"
47+ end
48+
49+ assert_match ( /Foo#methods: foo/ , out )
50+ end
51+
52+ def test_ls_basic_object
53+ out = run_ruby_file do
54+ type "ls BO"
55+ type "exit"
56+ end
57+
58+ assert_match ( /constants:.*ONE/ , out )
59+ assert_match ( /BO#methods: baz/ , out )
60+ end
61+
62+ def test_ls_basic_object_instance
63+ out = run_ruby_file do
64+ type "ls BO.new"
65+ type "exit"
66+ end
67+
68+ assert_match ( /BO#methods: baz/ , out )
69+ end
70+ end
71+ end
You can’t perform that action at this time.
0 commit comments