Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6dbf278

Browse files
tamasvajkigfoo
authored andcommitted
Add extension tests
1 parent 058ff0a commit 6dbf278

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
class SomeClass {
3+
fun someClassMethod() {}
4+
}
5+
class AnotherClass {
6+
fun anotherClassMethod() {}
7+
}
8+
9+
fun SomeClass.someFun() {}
10+
fun AnotherClass.anotherFun() {}
11+
12+
fun SomeClass.bothFun() {}
13+
fun AnotherClass.bothFun() {}
14+
15+
fun SomeClass.bothFunDiffTypes(): Int { return 5 }
16+
fun AnotherClass.bothFunDiffTypes(): String { return "Foo" }
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| extensions.kt:2:1:4:1 | <obinit> | file://<external>/Unit.class:0:0:0:0 | Unit |
2+
| extensions.kt:2:1:4:1 | equals | file://:0:0:0:0 | boolean |
3+
| extensions.kt:2:1:4:1 | hashCode | file://:0:0:0:0 | int |
4+
| extensions.kt:2:1:4:1 | toString | file://<external>/String.class:0:0:0:0 | String |
5+
| extensions.kt:3:5:3:28 | someClassMethod | file://:0:0:0:0 | void |
6+
| extensions.kt:5:1:7:1 | <obinit> | file://<external>/Unit.class:0:0:0:0 | Unit |
7+
| extensions.kt:5:1:7:1 | equals | file://:0:0:0:0 | boolean |
8+
| extensions.kt:5:1:7:1 | hashCode | file://:0:0:0:0 | int |
9+
| extensions.kt:5:1:7:1 | toString | file://<external>/String.class:0:0:0:0 | String |
10+
| extensions.kt:6:5:6:31 | anotherClassMethod | file://:0:0:0:0 | void |
11+
| extensions.kt:9:1:9:26 | someFun | file://:0:0:0:0 | void |
12+
| extensions.kt:10:1:10:32 | anotherFun | file://:0:0:0:0 | void |
13+
| extensions.kt:12:1:12:26 | bothFun | file://:0:0:0:0 | void |
14+
| extensions.kt:13:1:13:29 | bothFun | file://:0:0:0:0 | void |
15+
| extensions.kt:15:1:15:50 | bothFunDiffTypes | file://:0:0:0:0 | int |
16+
| extensions.kt:16:1:16:60 | bothFunDiffTypes | file://<external>/String.class:0:0:0:0 | String |
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java
2+
3+
// Stop external filepaths from appearing in the results
4+
class ClassLocation extends Class {
5+
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
6+
exists(string fullPath |
7+
super.hasLocationInfo(fullPath, sl, sc, el, ec) |
8+
if exists(this.getFile().getRelativePath())
9+
then path = fullPath
10+
else path = fullPath.regexpReplaceAll(".*/", "<external>/"))
11+
}
12+
}
13+
14+
from Method m
15+
where m.fromSource()
16+
select m, m.getReturnType()

0 commit comments

Comments
 (0)