Skip to content

Commit 099fc26

Browse files
committed
optimize and cleanup tests
1 parent c703b86 commit 099fc26

5 files changed

Lines changed: 23 additions & 49 deletions

File tree

jacodb-core/src/test/kotlin/org/jacodb/testing/cfg/BaseInstructionsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class BaseInstructionsTest : BaseTest() {
4343

4444
val ext = runBlocking { cp.hierarchyExt() }
4545

46-
fun runKotlinTest(className: String, muteGraphChecker: Boolean = false) {
46+
fun runTest(className: String, muteGraphChecker: Boolean = false) {
4747
val clazz = cp.findClassOrNull(className)
4848
Assertions.assertNotNull(clazz)
4949

jacodb-core/src/test/kotlin/org/jacodb/testing/cfg/IincTest.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717
package org.jacodb.testing.cfg
1818

1919
import org.jacodb.api.ext.findClass
20-
import org.jacodb.testing.WithDB
2120
import org.junit.jupiter.api.Assertions.assertArrayEquals
2221
import org.junit.jupiter.api.Assertions.assertEquals
2322
import org.junit.jupiter.api.Test
2423

2524
class IincTest : BaseInstructionsTest() {
2625

27-
companion object : WithDB()
28-
2926
@Test
3027
fun `iinc should work`() {
3128
val clazz = cp.findClass<Incrementation>()
@@ -105,15 +102,15 @@ class IincTest : BaseInstructionsTest() {
105102
}
106103

107104
@Test
108-
fun `kotlin iinc`() = runKotlinTest(Iinc::class.java.name)
105+
fun `kotlin iinc`() = runTest(Iinc::class.java.name)
109106

110107
@Test
111-
fun `kotlin iinc2`() = runKotlinTest(Iinc2::class.java.name)
108+
fun `kotlin iinc2`() = runTest(Iinc2::class.java.name)
112109

113110
@Test
114-
fun `kotlin iinc3`() = runKotlinTest(Iinc3::class.java.name)
111+
fun `kotlin iinc3`() = runTest(Iinc3::class.java.name)
115112

116113
@Test
117-
fun `kotlin iinc4`() = runKotlinTest(Iinc4::class.java.name)
114+
fun `kotlin iinc4`() = runTest(Iinc4::class.java.name)
118115

119116
}

jacodb-core/src/test/kotlin/org/jacodb/testing/cfg/InvokeDynamicTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
package org.jacodb.testing.cfg
1818

1919
import org.jacodb.api.ext.findClass
20-
import org.jacodb.testing.WithDB
20+
import org.jacodb.testing.WithGlobalDB
2121
import org.junit.jupiter.api.Assertions.assertEquals
2222
import org.junit.jupiter.api.Test
2323

2424
class InvokeDynamicTest : BaseInstructionsTest() {
2525

26-
companion object : WithDB()
26+
companion object : WithGlobalDB()
2727

2828
@Test
2929
fun `test unary function`() = runStaticMethod<InvokeDynamicExamples>("testUnaryFunction")

jacodb-core/src/test/kotlin/org/jacodb/testing/cfg/KotlinInstructionsTest.kt

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,60 @@
1616

1717
package org.jacodb.testing.cfg
1818

19-
import org.jacodb.testing.WithDB
2019
import org.junit.jupiter.api.Test
2120

2221
class KotlinInstructionsTest: BaseInstructionsTest() {
2322

24-
companion object : WithDB()
25-
2623
@Test
27-
fun `simple test`() = runKotlinTest(SimpleTest::class.java.name)
24+
fun `simple test`() = runTest(SimpleTest::class.java.name)
2825

2926
@Test
30-
fun `kotlin vararg test`() = runKotlinTest(Varargs::class.java.name)
27+
fun `kotlin vararg test`() = runTest(Varargs::class.java.name)
3128

3229
@Test
33-
fun `kotlin equals test`() = runKotlinTest(Equals::class.java.name)
30+
fun `kotlin equals test`() = runTest(Equals::class.java.name)
3431

3532
@Test
36-
fun `kotlin different receivers test`() = runKotlinTest(DifferentReceivers::class.java.name)
33+
fun `kotlin different receivers test`() = runTest(DifferentReceivers::class.java.name)
3734

3835
@Test
39-
fun `kotlin sequence test`() = runKotlinTest(KotlinSequence::class.java.name)
36+
fun `kotlin sequence test`() = runTest(KotlinSequence::class.java.name)
4037

4138
@Test
42-
fun `kotlin range test`() = runKotlinTest(Ranges::class.java.name)
39+
fun `kotlin range test`() = runTest(Ranges::class.java.name)
4340

4441
@Test
45-
fun `kotlin range test 2`() = runKotlinTest(Ranges2::class.java.name)
42+
fun `kotlin range test 2`() = runTest(Ranges2::class.java.name)
4643

4744
// @Test
4845
// fun `kotlin overloading test`() = runKotlinTest(Overloading::class.java.name)
4946

5047
//We have to mute graph checker because of empty catch-es in try/catch blocks
5148
@Test
52-
fun `kotlin try catch finally`() = runKotlinTest(TryCatchFinally::class.java.name, muteGraphChecker = true)
49+
fun `kotlin try catch finally`() = runTest(TryCatchFinally::class.java.name, muteGraphChecker = true)
5350

5451
@Test
55-
fun `kotlin try catch finally 2`() = runKotlinTest(TryCatchFinally2::class.java.name, muteGraphChecker = true)
52+
fun `kotlin try catch finally 2`() = runTest(TryCatchFinally2::class.java.name, muteGraphChecker = true)
5653

5754
@Test
58-
fun `kotlin try catch finally 3`() = runKotlinTest(TryCatchFinally3::class.java.name, muteGraphChecker = true)
55+
fun `kotlin try catch finally 3`() = runTest(TryCatchFinally3::class.java.name, muteGraphChecker = true)
5956

6057
@Test
61-
fun `kotlin try catch finally 4`() = runKotlinTest(TryCatchFinally4::class.java.name, muteGraphChecker = true)
58+
fun `kotlin try catch finally 4`() = runTest(TryCatchFinally4::class.java.name, muteGraphChecker = true)
6259

6360
@Test
64-
fun `kotlin method with exception`() = runKotlinTest(InvokeMethodWithException::class.java.name)
61+
fun `kotlin method with exception`() = runTest(InvokeMethodWithException::class.java.name)
6562

6663
@Test
67-
fun `kotlin typecast`() = runKotlinTest(DoubleComparison::class.java.name)
64+
fun `kotlin typecast`() = runTest(DoubleComparison::class.java.name)
6865

6966
@Test
70-
fun `kotlin when expr`() = runKotlinTest(WhenExpr::class.java.name)
67+
fun `kotlin when expr`() = runTest(WhenExpr::class.java.name)
7168

7269
@Test
73-
fun `kotlin default args`() = runKotlinTest(DefaultArgs::class.java.name)
70+
fun `kotlin default args`() = runTest(DefaultArgs::class.java.name)
7471

7572
@Test
76-
fun `kotlin arrays`() = runKotlinTest(Arrays::class.java.name)
73+
fun `kotlin arrays`() = runTest(Arrays::class.java.name)
7774

7875
}

jacodb-core/src/testFixtures/java/org/jacodb/testing/cfg/LocalResolverExample.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)