Ruby: add test case

This commit is contained in:
Arthur Baars
2022-10-05 10:54:50 +02:00
parent d5478a01ab
commit 4ff85d5275
3 changed files with 52 additions and 1 deletions

View File

@@ -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

View File

@@ -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 |

View File

@@ -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