Skip to content

Commit 4ed75de

Browse files
committed
refactor: update sample for call
1 parent 82373a2 commit 4ed75de

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Java CI
1+
name: Chapi CI
22

33
on: [push]
44

chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt

+2-34
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ internal class GoAnalyserTest {
1414
fun analysis() {
1515
val helloworld = """
1616
package main
17+
1718
import "fmt"
19+
1820
func main() {
1921
fmt.Println("hello world")
2022
}
@@ -37,38 +39,4 @@ func main() {
3739
)
3840
assertEquals(Json.encodeToString(value), Json.encodeToString(expect))
3941
}
40-
41-
@Test
42-
fun analysis2() {
43-
val helloworldApi = """package main
44-
45-
import (
46-
"github.com/gin-gonic/gin"
47-
"net/http"
48-
)
49-
50-
func main() {
51-
r := gin.Default()
52-
53-
r.GET("/", func(c *gin.Context) {
54-
c.String(http.StatusOK, "hello world")
55-
})
56-
57-
r.Run()
58-
}"""
59-
val container = GoAnalyser().analysis(helloworldApi, "")
60-
println(Json.encodeToString(container))
61-
val codeFunction = container.DataStructures[0].Functions[0]
62-
assertEquals(codeFunction.FunctionCalls[0].NodeName, "gin")
63-
assertEquals(codeFunction.FunctionCalls[0].FunctionName, "Default")
64-
65-
assertEquals(codeFunction.FunctionCalls[1].NodeName, "gin.Default()")
66-
assertEquals(codeFunction.FunctionCalls[1].FunctionName, "GET")
67-
68-
assertEquals(codeFunction.FunctionCalls[2].NodeName, "c")
69-
assertEquals(codeFunction.FunctionCalls[2].FunctionName, "String")
70-
71-
assertEquals(codeFunction.FunctionCalls[3].NodeName, "gin.Default()")
72-
assertEquals(codeFunction.FunctionCalls[3].FunctionName, "Run")
73-
}
7442
}

0 commit comments

Comments
 (0)