Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Add a few tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
max-schaefer committed Sep 28, 2020
1 parent 56f295f commit 97fb967
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ql/test/library-tests/semmle/go/Function/getParameter.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
| main.go:7:6:7:7 | f1 | 0 | main.go:7:9:7:9 | x |
| main.go:9:12:9:13 | f2 | 0 | main.go:9:15:9:15 | x |
| main.go:9:12:9:13 | f2 | 1 | main.go:9:18:9:18 | y |
| main.go:9:12:9:13 | f2 | -1 | main.go:9:7:9:7 | t |
| main.go:11:12:11:13 | f3 | 0 | main.go:11:15:11:15 | x |
| main.go:11:12:11:13 | f3 | 1 | main.go:11:22:11:22 | y |
| main.go:11:12:11:13 | f3 | -1 | main.go:11:7:11:7 | _ |
| main.go:13:6:13:7 | f4 | 0 | main.go:13:9:13:9 | x |
| main.go:13:6:13:7 | f4 | 1 | main.go:13:16:13:16 | y |
| main.go:15:6:15:7 | f5 | 0 | main.go:15:9:15:9 | x |
| main.go:17:6:17:7 | f6 | 0 | main.go:17:9:17:9 | x |
4 changes: 4 additions & 0 deletions ql/test/library-tests/semmle/go/Function/getParameter.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import go

from Function f, int i
select f, i, f.getParameter(i)
7 changes: 7 additions & 0 deletions ql/test/library-tests/semmle/go/Function/getResult.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
| main.go:17:6:17:7 | f6 | 0 | main.go:17:17:17:17 | y |
| main.go:19:6:19:7 | f7 | 0 | main.go:19:12:19:12 | x |
| main.go:19:6:19:7 | f7 | 1 | main.go:19:15:19:15 | y |
| main.go:21:6:21:7 | f8 | 0 | main.go:21:12:21:12 | x |
| main.go:21:6:21:7 | f8 | 1 | main.go:21:19:21:19 | _ |
| main.go:23:6:23:7 | f9 | 0 | main.go:23:12:23:12 | _ |
| main.go:23:6:23:7 | f9 | 1 | main.go:23:19:23:19 | y |
4 changes: 4 additions & 0 deletions ql/test/library-tests/semmle/go/Function/getResult.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import go

from Function f, int i
select f, i, f.getResult(i)
23 changes: 23 additions & 0 deletions ql/test/library-tests/semmle/go/Function/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

type t int

func main() {}

func f1(x int) {}

func (t t) f2(x, y int) {}

func (_ t) f3(x int, y string) {}

func f4(x int, y ...string) {}

func f5(x int) int { return 0 }

func f6(x int) (y int) { return 0 }

func f7() (x, y int) { return 0, 0 }

func f8() (x int, _ string) { return 0, "" }

func f9() (_ int, y string) { return 0, "" }

0 comments on commit 97fb967

Please sign in to comment.