Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for info consts with an expression #886

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 58 additions & 23 deletions test/console/info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,29 +127,36 @@ class InfoConstantTest < ConsoleTestCase
def program
<<~RUBY
1|
1| class C0
2| C0_CONST1 = -1
3| C0_CONST2 = -2
4| end
5|
6| class D
7| D_CONST1 = 1
8| D_CONST2 = 1
9| class C1 < C0
10| CONST1 = 1
11| CONST2 = 2
12| l1 = 10
13| l2 = 20
14| @i1 = 100
15| @i2 = 200
16|
17| def foo
18| :foo
19| end
20| end
21| end
22|
23| D::C1.new.foo
2| class C0
3| C0_CONST1 = -1
4| C0_CONST2 = -2
5| end
6|
7| class D
8| D_CONST1 = 1
9| D_CONST2 = 1
10| class C1 < C0
11| CONST1 = 1
12| CONST2 = 2
13| l1 = 10
14| l2 = 20
15| @i1 = 100
16| @i2 = 200
17|
18| def foo
19| :foo
20| end
21| end
22| end
23|
24| class E
25| E_CONST1 = C0
26| def self.foo
27| D
28| end
29| end
30|
31| D::C1.new.foo
RUBY
end

Expand Down Expand Up @@ -213,6 +220,34 @@ def test_info_constant_twice
type 'c'
end
end

def test_info_constant_with_expression
debug_code(program) do
type "b 31"
type "c"
assert_line_num 31

type "info constants E"
assert_line_text([
/E_CONST1 = C0/,
])

type "info constants E.foo"
assert_line_text([
/C1 = D::C1/,
/D_CONST1 = 1/,
/D_CONST2 = 1/,
])

type "info constants E::E_CONST1"
assert_line_text([
/C0_CONST1 = -1/,
/C0_CONST2 = -2/,
])

type "c"
end
end
end

class InfoIvarsTest < ConsoleTestCase
Expand Down