@@ -14,7 +14,9 @@ internal class GoAnalyserTest {
14
14
fun analysis () {
15
15
val helloworld = """
16
16
package main
17
+
17
18
import "fmt"
19
+
18
20
func main() {
19
21
fmt.Println("hello world")
20
22
}
@@ -37,38 +39,4 @@ func main() {
37
39
)
38
40
assertEquals(Json .encodeToString(value), Json .encodeToString(expect))
39
41
}
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
- }
74
42
}
0 commit comments