Skip to content

Commit 038bdec

Browse files
committed
Ruby: add test with compound assignment to a constant
1 parent ac013f9 commit 038bdec

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

ruby/ql/test/library-tests/controlflow/graph/Cfg.expected

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,7 +3696,7 @@ cfg.rb:
36963696
#-----| -> exit filter_nil
36973697

36983698
# 207| filter_nil
3699-
#-----| -> self
3699+
#-----| -> exit cfg.rb (normal)
37003700

37013701
# 207| list
37023702
#-----| -> list
@@ -3733,34 +3733,14 @@ cfg.rb:
37333733
# 209| call to nil?
37343734
#-----| -> exit do ... end (normal)
37353735

3736-
# 213| call to do_something
3737-
#-----| -> exit cfg.rb (normal)
3738-
3739-
# 213| self
3740-
#-----| -> do ... end
3741-
3742-
# 213| do ... end
3743-
#-----| -> call to do_something
3744-
3745-
# 213| enter do ... end
3746-
#-----| -> self
3747-
3748-
# 213| exit do ... end
3749-
3750-
# 213| exit do ... end (normal)
3751-
#-----| -> exit do ... end
3752-
3753-
# 214| self
3754-
#-----| -> call to something
3736+
constant_compound_assign.rb:
3737+
# 1| Foo
3738+
#-----| -> foo_before
37553739

3756-
# 214| call to something
3757-
#-----| -> self
3758-
3759-
# 215| call to something_else
3760-
#-----| -> exit do ... end (normal)
3740+
# 1| enter constant_compound_assign.rb
3741+
#-----| -> Foo
37613742

3762-
# 215| self
3763-
#-----| -> call to something_else
3743+
# 2| foo_before
37643744

37653745
desugar.rb:
37663746
# 1| enter m1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module Foo
2+
def foo_before
3+
end
4+
5+
FOO_CONSTANT ||= 123
6+
7+
def foo_after
8+
end
9+
end
10+
11+
def top_before
12+
end
13+
14+
TOP_CONSTANT ||= 123
15+
16+
def top_after
17+
end

0 commit comments

Comments
 (0)