From d1c34a5abe253b01cfa1580d67464c242c84f5c6 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sun, 9 Feb 2020 21:23:06 +0800 Subject: [PATCH] feat: add basic dir support --- .../test/kotlin/chapi/app/analyser/ChapiAnalyserTest.kt | 9 +++++++++ .../kotlin/chapi/ast/javaast/JavaFullIdentListener.kt | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chapi-application/src/test/kotlin/chapi/app/analyser/ChapiAnalyserTest.kt b/chapi-application/src/test/kotlin/chapi/app/analyser/ChapiAnalyserTest.kt index a775065a..508112be 100644 --- a/chapi-application/src/test/kotlin/chapi/app/analyser/ChapiAnalyserTest.kt +++ b/chapi-application/src/test/kotlin/chapi/app/analyser/ChapiAnalyserTest.kt @@ -31,4 +31,13 @@ internal class ChapiAnalyserTest { val nodes = ChapiAnalyser().analysisByFiles(files) assertEquals(nodes.size, 1) } + + @Test + fun analysisByDir() { + val resource = this.javaClass.classLoader.getResource("e2e/step2-java/") + val path = Paths.get(resource!!.toURI()).toFile() + + val nodes = ChapiAnalyser().analysisByPath(path.absolutePath) + assertEquals(nodes.size, 14) + } } diff --git a/chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt b/chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt index 1a2c9aa7..6d0c527a 100644 --- a/chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt +++ b/chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt @@ -557,7 +557,6 @@ open class JavaFullIdentListener(fileName: String) : JavaAstListener() { } override fun enterCreator(ctx: JavaParser.CreatorContext?) { - println("enterCreator") val variableName = ctx!!.getParent().getParent().getChild(0).text val allIdentifier = ctx.createdName().IDENTIFIER() for (identifier in allIdentifier!!) {