Add tests for FunctionOutput.isResult

This commit is contained in:
Owen Mansel-Chan
2020-05-27 09:42:24 +01:00
parent 4206408826
commit 53cfbcc255
4 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
| main.go:51:2:51:14 | call to op | main.go:51:2:51:14 | call to op | result |
| main.go:53:2:53:22 | call to op2 | main.go:53:2:53:22 | call to op2 | result |
| main.go:53:14:53:21 | call to bump | main.go:53:14:53:21 | call to bump | result |
| tst.go:9:17:9:33 | call to new | tst.go:9:17:9:33 | call to new | result |

View File

@@ -0,0 +1,5 @@
import go
from FunctionOutput outp, DataFlow::CallNode c, DataFlow::Node nodeTo
where outp.isResult() and nodeTo = outp.getNode(c)
select c, nodeTo, outp

View File

@@ -0,0 +1,4 @@
| main.go:54:10:54:15 | call to test | main.go:54:2:54:15 | ... := ...[0] | 0 | result 0 |
| main.go:54:10:54:15 | call to test | main.go:54:2:54:15 | ... := ...[1] | 1 | result 1 |
| main.go:56:9:56:15 | call to test2 | main.go:56:2:56:15 | ... = ...[0] | 0 | result 0 |
| main.go:56:9:56:15 | call to test2 | main.go:56:2:56:15 | ... = ...[1] | 1 | result 1 |

View File

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