Skip to content

Commit

Permalink
test++
Browse files Browse the repository at this point in the history
  • Loading branch information
maximiliankaul committed Nov 28, 2024
1 parent f00acbb commit 0549629
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression
import de.fraunhofer.aisec.cpg.graph.statements.expressions.Literal
import de.fraunhofer.aisec.cpg.graph.statements.expressions.ProblemExpression
import de.fraunhofer.aisec.cpg.helpers.Util
import org.eclipse.cdt.core.dom.ast.*
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler
import org.eclipse.cdt.internal.core.dom.parser.cpp.*
import java.util.*
import java.util.function.BiConsumer
import java.util.function.Supplier
import java.util.stream.Collectors
import org.eclipse.cdt.core.dom.ast.*
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler
import org.eclipse.cdt.internal.core.dom.parser.cpp.*

class StatementHandler(lang: CXXLanguageFrontend) :
CXXHandler<Statement, IASTStatement>(Supplier(::ProblemExpression), lang) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,6 @@ internal class CXXLanguageFrontendTest : BaseTest() {
}

@Test
@Throws(Exception::class)
fun testGoto() {
val file = File("src/test/resources/c/goto.c")
val tu =
Expand All @@ -1768,11 +1767,15 @@ internal class CXXLanguageFrontendTest : BaseTest() {
}
assertNotNull(tu)

val labelCName = "LAB_123"

val goto = tu.allChildren<GotoStatement>().firstOrNull()
assertIs<GotoStatement>(goto)
assertEquals(labelCName, goto.labelName)

val label = tu.labels["LAB_123"]
val label = tu.labels[labelCName]
assertIs<LabelStatement>(label)
assertLocalName(labelCName, label)

assertEquals(label, goto.targetLabel)
}
Expand Down

0 comments on commit 0549629

Please sign in to comment.