Skip to content

Commit 2eb9b61

Browse files
committed
Kotlin: Add a test for path transformers
1 parent 79d9109 commit 2eb9b61

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| file:///src/kotlin_source.kt:1:1:2:1 | Foo |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import java
2+
3+
from Class c
4+
where c.fromSource()
5+
select c
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Foo {
2+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from create_database_utils import *
2+
3+
path_transformer_file = 'path_transformer'
4+
root = os.getcwd().replace('\\', '/')
5+
with open(path_transformer_file, 'w') as f:
6+
f.write('#/src\n' + root + '//\n')
7+
os.environ['SEMMLE_PATH_TRANSFORMER'] = root + '/' + path_transformer_file
8+
9+
run_codeql_database_create(["kotlinc kotlin_source.kt"], lang="java")
10+
files = ['test-db/trap/java/src/kotlin_source.kt.trap.gz', 'test-db/src/src/kotlin_source.kt']
11+
exists = list(map(os.path.exists, files))
12+
if exists != [True] * 2:
13+
print(exists)
14+
raise Exception("Didn't get expected filed")

0 commit comments

Comments
 (0)