Skip to content

Commit 6633952

Browse files
committed
Java: add tests for compact source files
1 parent cd80877 commit 6633952

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| Test.java:1:1:1:1 | <clinit> | in compact source |
2+
| Test.java:1:1:1:1 | <obinit> | in compact source |
3+
| Test.java:5:6:5:9 | main | in compact source |
4+
| Test.java:11:6:11:16 | processData | in compact source |
5+
| Test.java:16:14:16:31 | updatePrivateField | in compact source |
6+
| Test.java:21:13:21:28 | testStaticAccess | in compact source |
7+
| Test.java:27:10:27:25 | methodNotCompact | NOT in compact source |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import java
2+
3+
from Method m, Class c, string res
4+
where
5+
c = m.getDeclaringType() and
6+
exists(c.getCompilationUnit().getRelativePath()) and
7+
if c.isImplicit() then res = "in compact source" else res = "NOT in compact source"
8+
select m, res

java/ql/test/library-tests/compact-source-files/PrintAst.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ Test.java:
4040
# 22| -1: [TypeAccess] IO
4141
# 22| 0: [StringLiteral] "Static access test"
4242
# 25| 11: [Class] NotCompact
43+
# 27| 2: [Method] methodNotCompact
44+
# 27| 3: [TypeAccess] void
45+
# 27| 5: [BlockStmt] { ... }

java/ql/test/library-tests/compact-source-files/Test.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ static void testStaticAccess() {
2424

2525
class NotCompact {
2626
//Test explict class
27+
void methodNotCompact() {
28+
}
2729
}

0 commit comments

Comments
 (0)