Skip to content

Commit 9871698

Browse files
committed
Add more CFG tests
1 parent b9b6ffe commit 9871698

2 files changed

Lines changed: 117 additions & 1 deletion

File tree

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

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3173,6 +3173,9 @@ raise.rb:
31733173

31743174
# 1| exit raise.rb
31753175

3176+
# 1| exit raise.rb (abnormal)
3177+
#-----| -> exit raise.rb
3178+
31763179
# 1| exit raise.rb (normal)
31773180
#-----| -> exit raise.rb
31783181

@@ -4253,7 +4256,7 @@ raise.rb:
42534256
#-----| -> element
42544257

42554258
# 154| m14
4256-
#-----| -> exit raise.rb (normal)
4259+
#-----| -> m15
42574260

42584261
# 154| exit m14
42594262

@@ -4304,3 +4307,102 @@ raise.rb:
43044307

43054308
# 155| element
43064309
#-----| -> call to nil?
4310+
4311+
# 158| enter m15
4312+
#-----| -> self
4313+
4314+
# 158| m15
4315+
#-----| -> self
4316+
4317+
# 158| exit m15
4318+
4319+
# 158| exit m15 (normal)
4320+
#-----| -> exit m15
4321+
4322+
# 159| call to foo
4323+
#-----| -> exit m15 (normal)
4324+
4325+
# 159| self
4326+
#-----| -> do ... end
4327+
4328+
# 159| enter do ... end
4329+
#-----| -> self
4330+
4331+
# 159| do ... end
4332+
#-----| -> call to foo
4333+
4334+
# 159| exit do ... end
4335+
4336+
# 159| exit do ... end (abnormal)
4337+
#-----| -> exit do ... end
4338+
4339+
# 159| exit do ... end (normal)
4340+
#-----| -> exit do ... end
4341+
4342+
# 160| call to bar
4343+
#-----| -> exit do ... end (normal)
4344+
4345+
# 160| self
4346+
#-----| -> -> { ... }
4347+
4348+
# 160| enter -> { ... }
4349+
#-----| -> x
4350+
4351+
# 160| -> { ... }
4352+
#-----| -> call to bar
4353+
4354+
# 160| exit -> { ... }
4355+
4356+
# 160| exit -> { ... } (abnormal)
4357+
#-----| -> exit -> { ... }
4358+
4359+
# 160| exit -> { ... } (normal)
4360+
#-----| -> exit -> { ... }
4361+
4362+
# 160| x
4363+
#-----| -> x
4364+
4365+
# 161| call to raise
4366+
#-----| raise -> exit do ... end (abnormal)
4367+
#-----| raise -> exit -> { ... } (abnormal)
4368+
4369+
# 161| ... unless ...
4370+
#-----| -> exit -> { ... } (normal)
4371+
4372+
# 161| self
4373+
#-----| -> ""
4374+
4375+
# 161| ""
4376+
#-----| -> call to raise
4377+
4378+
# 161| x
4379+
#-----| true -> ... unless ...
4380+
#-----| false -> self
4381+
4382+
# 166| C
4383+
#-----| -> exit raise.rb (normal)
4384+
4385+
# 167| enter m
4386+
#-----| -> self
4387+
4388+
# 167| m
4389+
#-----| -> C
4390+
4391+
# 167| exit m
4392+
4393+
# 167| exit m (abnormal)
4394+
#-----| -> exit m
4395+
4396+
# 167| self
4397+
#-----| -> m
4398+
4399+
# 168| call to raise
4400+
#-----| raise -> C
4401+
#-----| raise -> exit m (abnormal)
4402+
#-----| raise -> exit raise.rb (abnormal)
4403+
4404+
# 168| self
4405+
#-----| -> ""
4406+
4407+
# 168| ""
4408+
#-----| -> call to raise

ql/test/library-tests/controlflow/graph/raise.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,17 @@ def m13
154154
def m14 element
155155
element.each { |elem| raise "" if element.nil? }
156156
end
157+
158+
def m15
159+
foo do
160+
bar ->(x) do
161+
raise "" unless x
162+
end
163+
end
164+
end
165+
166+
class C
167+
def self.m()
168+
raise ""
169+
end
170+
end

0 commit comments

Comments
 (0)