From 0b49fcafd5644bbcddfadd8b35d23562d7e4dba5 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Wed, 12 Feb 2020 09:33:44 +0800 Subject: [PATCH] feat: remove unused double quote --- .../src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt | 3 ++- .../src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt b/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt index aa5ed424..592d920b 100644 --- a/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt +++ b/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt @@ -21,7 +21,8 @@ class GoFullIdentListener(var fileName: String) : GoAstListener() { } override fun enterImportSpec(ctx: GoParser.ImportSpecContext?) { - val sourceName = ctx!!.importPath().text + val originSource = ctx!!.importPath().text + val sourceName = originSource.replace("\"", "") val codeImport = CodeImport(Source = sourceName) if (ctx.DOT() != null) { diff --git a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt index 71dfdd3a..3814d2a3 100644 --- a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt +++ b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt @@ -24,6 +24,6 @@ import "fmt" val codeFile = GoAnalyser().analysis(code, "") assertEquals(codeFile.Imports.size, 1) - assertEquals(codeFile.Imports[0].Source, "\"fmt\"") + assertEquals(codeFile.Imports[0].Source, "fmt") } }