Skip to content

Commit

Permalink
add astParent test for tupledeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
maximiliankaul committed Nov 6, 2024
1 parent 1cad7a4 commit 1d00626
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import de.fraunhofer.aisec.cpg.graph.types.TupleType
import de.fraunhofer.aisec.cpg.test.*
import kotlin.test.Test
import kotlin.test.assertContains
import kotlin.test.assertEquals
import kotlin.test.assertIs
import kotlin.test.assertNotNull

Expand Down Expand Up @@ -91,11 +92,13 @@ class TupleDeclarationTest {
assertNotNull(a)
assertLocalName("MyClass", a.type)
assertContains(a.prevDFG, call)
assertEquals(tuple, a.astParent)

val b = tuple.elements["b"]
assertNotNull(b)
assertLocalName("error", b.type)
assertContains(b.prevDFG, call)
assertEquals(tuple, b.astParent)

val callPrint = main.calls["print"]
assertNotNull(callPrint)
Expand Down Expand Up @@ -169,11 +172,13 @@ class TupleDeclarationTest {
assertNotNull(a)
assertLocalName("MyClass", a.type)
assertContains(a.prevDFG, call)
assertEquals(tuple, a.astParent)

val b = tuple.elements["b"]
assertNotNull(b)
assertLocalName("error", b.type)
assertContains(b.prevDFG, call)
assertEquals(tuple, b.astParent)

val callPrint = main.calls["print"]
assertNotNull(callPrint)
Expand Down

0 comments on commit 1d00626

Please sign in to comment.