mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Add stub generation tests
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
noGeneratedStubs
|
||||
multipleGeneratedStubs
|
||||
#select
|
||||
| org.test.SampleAnnotationType | // Generated automatically from org.test.SampleAnnotationType for testing purposes\n\npackage org.test;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Target;\n\n@Target(value={ElementType.METHOD})\npublic @interface SampleAnnotationType\n{\n}\n |
|
||||
| org.test.SampleType | // Generated automatically from org.test.SampleType for testing purposes\n\npackage org.test;\n\n\npublic class SampleType\n{\n public Object sampleField = null;\n public SampleType(){}\n public void sampleMethod(){}\n}\n |
|
||||
@@ -0,0 +1 @@
|
||||
utils/stub-generator/MinimalStubsFromSource.ql
|
||||
13
java/ql/test/query-tests/Stubs/Minimal/Test.java
Normal file
13
java/ql/test/query-tests/Stubs/Minimal/Test.java
Normal file
@@ -0,0 +1,13 @@
|
||||
import org.test.SampleAnnotationType;
|
||||
import org.test.SampleType;
|
||||
|
||||
public class Test {
|
||||
|
||||
@SampleAnnotationType
|
||||
public void test() {
|
||||
new SampleType().sampleField = null;
|
||||
new SampleType().sampleMethod();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1
java/ql/test/query-tests/Stubs/Minimal/options
Normal file
1
java/ql/test/query-tests/Stubs/Minimal/options
Normal file
@@ -0,0 +1 @@
|
||||
//semmle-extractor-options: --javac-args -cp ${testdir}/testlib.jar
|
||||
BIN
java/ql/test/query-tests/Stubs/Minimal/testlib.jar
Normal file
BIN
java/ql/test/query-tests/Stubs/Minimal/testlib.jar
Normal file
Binary file not shown.
5
java/ql/test/query-tests/Stubs/testlib/README.md
Normal file
5
java/ql/test/query-tests/Stubs/testlib/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# testlib
|
||||
|
||||
Library for testing stub generation (we need a binary dependency because normal stubs are source files, and thus are excluded by the stub generator).
|
||||
|
||||
Run `generate.sh` to update `testlib.jar` in the test directory.
|
||||
3
java/ql/test/query-tests/Stubs/testlib/generate.sh
Normal file
3
java/ql/test/query-tests/Stubs/testlib/generate.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#/bin/bash
|
||||
javac org/test/*.java
|
||||
jar cf ../Minimal/testlib.jar org/test/*.class
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.test;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface SampleAnnotationType {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.test;
|
||||
|
||||
public class SampleType {
|
||||
|
||||
public Object sampleField;
|
||||
|
||||
public void sampleMethod() {}
|
||||
}
|
||||
Reference in New Issue
Block a user