Add tests for CallNode.getResult

This commit is contained in:
Owen Mansel-Chan
2020-05-27 09:28:47 +01:00
parent 53cfbcc255
commit ae2ed877ee
8 changed files with 30 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
| main.go:7:14:7:24 | ...+... | + | main.go:7:14:7:14 | x | main.go:7:19:7:23 | ...+... |
| main.go:7:19:7:23 | ...+... | + | main.go:7:19:7:19 | y | main.go:7:23:7:23 | z |
| main.go:15:2:15:13 | ... += ... | + | main.go:15:2:15:6 | index expression | main.go:15:11:15:13 | "!" |
| main.go:10:14:10:18 | ...+... | + | main.go:10:14:10:14 | x | main.go:10:18:10:18 | y |
| main.go:17:2:17:13 | ... += ... | + | main.go:17:2:17:6 | index expression | main.go:17:11:17:13 | "!" |

View File

@@ -1,4 +1,6 @@
| main.go:7:2:7:25 | call to Println |
| main.go:8:5:8:7 | call to f |
| main.go:12:8:12:24 | call to make |
| main.go:14:2:14:26 | call to Println |
| main.go:9:9:9:14 | call to test |
| main.go:10:2:10:19 | call to Println |
| main.go:14:8:14:24 | call to make |
| main.go:16:2:16:26 | call to Println |

View File

@@ -1,5 +1,6 @@
| main.go:7:2:7:25 | call to Println | 0 | main.go:7:14:7:24 | ...+... |
| main.go:12:8:12:24 | call to make | 0 | main.go:12:23:12:23 | 1 |
| main.go:14:2:14:26 | call to Println | 0 | main.go:14:14:14:15 | ss |
| main.go:14:2:14:26 | call to Println | 1 | main.go:14:18:14:18 | 0 |
| main.go:14:2:14:26 | call to Println | 2 | main.go:14:21:14:25 | index expression |
| main.go:10:2:10:19 | call to Println | 0 | main.go:10:14:10:18 | ...+... |
| main.go:14:8:14:24 | call to make | 0 | main.go:14:23:14:23 | 1 |
| main.go:16:2:16:26 | call to Println | 0 | main.go:16:14:16:15 | ss |
| main.go:16:2:16:26 | call to Println | 1 | main.go:16:18:16:18 | 0 |
| main.go:16:2:16:26 | call to Println | 2 | main.go:16:21:16:25 | index expression |

View File

@@ -0,0 +1 @@
| main.go:14:8:14:24 | call to make | main.go:14:8:14:24 | call to make |

View File

@@ -0,0 +1,5 @@
import go
from DataFlow::CallNode c, DataFlow::Node outp
where outp = c.getResult()
select c, outp

View File

@@ -0,0 +1,2 @@
| main.go:9:9:9:14 | call to test | 0 | main.go:9:2:9:14 | ... = ...[0] |
| main.go:9:9:9:14 | call to test | 1 | main.go:9:2:9:14 | ... = ...[1] |

View File

@@ -0,0 +1,5 @@
import go
from DataFlow::CallNode c, int i, DataFlow::Node outp
where outp = c.getResult(i)
select c, i, outp

View File

@@ -6,6 +6,8 @@ func main() {
x, y, z := 1, 2, 3
fmt.Println(x + (y + z))
go f()
x, y = test()
fmt.Println(x + y)
}
func f() {
@@ -14,3 +16,7 @@ func f() {
fmt.Println(ss, 0, ss[0])
ss[0] += "!"
}
func test() (int, int) {
return 23, 42
}