Skip to content

Commit ae71828

Browse files
committed
Ruby: add more tests for singleton up/down calls
1 parent 789f591 commit ae71828

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ruby/ql/test/library-tests/modules/callgraph.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ getTarget
213213
| calls.rb:549:2:549:6 | call to new | calls.rb:117:5:117:16 | new |
214214
| calls.rb:549:20:549:24 | call to baz | calls.rb:51:5:57:7 | baz |
215215
| calls.rb:550:26:550:37 | call to capitalize | calls.rb:97:5:97:23 | capitalize |
216+
| calls.rb:557:5:557:13 | call to singleton | calls.rb:553:5:554:7 | singleton |
217+
| calls.rb:560:9:560:17 | call to singleton | calls.rb:553:5:554:7 | singleton |
218+
| calls.rb:561:9:561:18 | call to singleton2 | calls.rb:565:5:566:7 | singleton2 |
219+
| calls.rb:568:5:568:14 | call to mid_method | calls.rb:559:5:562:7 | mid_method |
216220
| hello.rb:12:5:12:24 | call to include | calls.rb:108:5:110:7 | include |
217221
| hello.rb:14:16:14:20 | call to hello | hello.rb:2:5:4:7 | hello |
218222
| hello.rb:20:16:20:20 | call to super | hello.rb:13:5:15:7 | message |
@@ -335,6 +339,7 @@ unresolvedCall
335339
| calls.rb:549:1:549:26 | call to each |
336340
| calls.rb:550:1:550:13 | call to [] |
337341
| calls.rb:550:1:550:39 | call to each |
342+
| calls.rb:558:5:558:14 | call to singleton2 |
338343
| hello.rb:20:16:20:26 | ... + ... |
339344
| hello.rb:20:16:20:34 | ... + ... |
340345
| hello.rb:20:16:20:40 | ... + ... |
@@ -440,6 +445,9 @@ publicMethod
440445
| calls.rb:485:5:487:7 | singleton |
441446
| calls.rb:526:5:531:7 | baz |
442447
| calls.rb:539:5:542:7 | baz |
448+
| calls.rb:553:5:554:7 | singleton |
449+
| calls.rb:559:5:562:7 | mid_method |
450+
| calls.rb:565:5:566:7 | singleton2 |
443451
| hello.rb:2:5:4:7 | hello |
444452
| hello.rb:5:5:7:7 | world |
445453
| hello.rb:13:5:15:7 | message |

ruby/ql/test/library-tests/modules/calls.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,3 +548,22 @@ def baz
548548

549549
[C.new].each { |c| c.baz }
550550
["a","b","c"].each { |s| s.capitalize }
551+
552+
class SingletonUpCall_Base
553+
def self.singleton
554+
end
555+
end
556+
class SingletonUpCall_Sub < SingletonUpCall_Base
557+
singleton
558+
singleton2 # should not resolve
559+
def self.mid_method
560+
singleton
561+
singleton2 # should resolve
562+
end
563+
end
564+
class SingletonUpCall_SubSub < SingletonUpCall_Sub
565+
def self.singleton2
566+
end
567+
568+
mid_method
569+
end

0 commit comments

Comments
 (0)