1
1
Fork 0

Generated tests for Java samples

This commit is contained in:
Svetlana Isakova 2020-11-09 12:56:31 +01:00
parent 68a522d0a3
commit 22302d3a45
4 changed files with 40 additions and 8 deletions

View File

@ -8,8 +8,7 @@ public class JavaChecked {
// Build path to current source file, based
// on directory where Gradle is invoked:
static Path thisFile = Paths.get(
"Examples", "Interoperability",
"JavaChecked.java");
"DataFiles", "file_real.txt");
public static void main(String[] args) {
BufferedReader source = null;
try {
@ -20,8 +19,7 @@ public class JavaChecked {
}
try {
String first = source.readLine();
eq(first, "// Interoperability/" +
"JavaChecked.java");
eq(first, "wubba lubba dub dub");
} catch(IOException e) {
// Recover from read() error
}

View File

@ -1,6 +1,5 @@
// Interoperability/KotlinChecked.kt
import atomictest.eq
import checkinstructions.DataFile
import java.io.File
fun main() {

View File

@ -6,6 +6,9 @@ files:
- offset: 161
length: 31
placeholder_text: '// TODO: add values'
- offset: 220
length: 5
placeholder_text: TODO()
- offset: 305
length: 154
placeholder_text: |-
@ -26,8 +29,5 @@ files:
- offset: 655
length: 15
placeholder_text: log("Error", msg)
- offset: 220
length: 5
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -2521,6 +2521,41 @@ public class TestAllExamples extends AbstractTestExamples {
testExample("Appendices/Java Interoperability/Examples/src/KotlinChecked.kt", KotlinCheckedKt::main);
}
@Test
public void testUsingKotlinClass() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/UsingKotlinClass.java", Interoperability.UsingKotlinClass::main);
}
@Test
public void testMakeSalad() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/MakeSalad.java", Interoperability.MakeSalad::main);
}
@Test
public void testCallTopLevelFunction() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/CallTopLevelFunction.java", Interoperability.CallTopLevelFunction::main);
}
@Test
public void testCatchChecked() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/CatchChecked.java", Interoperability.CatchChecked::main);
}
@Test
public void testJavaChecked() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/JavaChecked.java", Interoperability.JavaChecked::main);
}
@Test
public void testCallTopLevelFunction2() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/CallTopLevelFunction2.java", Interoperability.CallTopLevelFunction2::main);
}
@Test
public void testUsingDataClass() {
testExample("Appendices/Java Interoperability/Examples/src/Interoperability/UsingDataClass.java", Interoperability.UsingDataClass::main);
}
@Test
public void testHiddenArrayList() {
testExample("Appendices/Java Interoperability/Examples/src/HiddenArrayList.kt", HiddenArrayListKt::main);