mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Ruby: add test case
This commit is contained in:
@@ -3649,7 +3649,7 @@ cfg.rb:
|
||||
#-----| -> call to foo
|
||||
|
||||
# 205| ...
|
||||
#-----| -> exit cfg.rb (normal)
|
||||
#-----| -> filter_nil
|
||||
|
||||
# 205| call to bar
|
||||
#-----| -> if ...
|
||||
@@ -3687,6 +3687,49 @@ cfg.rb:
|
||||
# 205| x
|
||||
#-----| -> exit { ... } (normal)
|
||||
|
||||
# 207| enter filter_nil
|
||||
#-----| -> list
|
||||
|
||||
# 207| exit filter_nil
|
||||
|
||||
# 207| exit filter_nil (normal)
|
||||
#-----| -> exit filter_nil
|
||||
|
||||
# 207| filter_nil
|
||||
#-----| -> exit cfg.rb (normal)
|
||||
|
||||
# 207| list
|
||||
#-----| -> list
|
||||
|
||||
# 208| list
|
||||
#-----| -> do ... end
|
||||
|
||||
# 208| call to reject
|
||||
#-----| -> exit filter_nil (normal)
|
||||
|
||||
# 208| do ... end
|
||||
#-----| -> call to reject
|
||||
|
||||
# 208| enter do ... end
|
||||
#-----| -> elem
|
||||
|
||||
# 208| exit do ... end
|
||||
|
||||
# 208| exit do ... end (normal)
|
||||
#-----| -> exit do ... end
|
||||
|
||||
# 208| elem
|
||||
#-----| -> rest
|
||||
|
||||
# 208| rest
|
||||
#-----| -> elem
|
||||
|
||||
# 209| elem
|
||||
#-----| -> call to nil?
|
||||
|
||||
# 209| call to nil?
|
||||
#-----| -> exit do ... end (normal)
|
||||
|
||||
desugar.rb:
|
||||
# 1| enter m1
|
||||
#-----| -> x
|
||||
|
||||
@@ -42,6 +42,8 @@ callsWithNoArguments
|
||||
| cfg.rb:200:1:200:32 | call to times |
|
||||
| cfg.rb:202:1:202:35 | call to times |
|
||||
| cfg.rb:205:1:205:3 | call to foo |
|
||||
| cfg.rb:208:3:210:5 | call to reject |
|
||||
| cfg.rb:209:5:209:13 | call to nil? |
|
||||
| desugar.rb:6:3:6:7 | call to foo |
|
||||
| desugar.rb:10:3:10:7 | call to foo |
|
||||
| desugar.rb:14:3:14:7 | call to foo |
|
||||
|
||||
@@ -204,6 +204,12 @@ end
|
||||
# A call with a safe navigation operator
|
||||
foo&.bar(1,2) { |x| x }
|
||||
|
||||
def filter_nil list
|
||||
list.reject do |elem, *rest|
|
||||
elem.nil?
|
||||
end
|
||||
end
|
||||
|
||||
__END__
|
||||
|
||||
Some ignored nonsense
|
||||
|
||||
Reference in New Issue
Block a user