Skip to content

Commit 193edda

Browse files
committed
Add non-functional bazel tests
They don't build with bazel. They are only there to check that we emit the right diagnostic.
1 parent a852173 commit 193edda

File tree

18 files changed

+180
-0
lines changed

18 files changed

+180
-0
lines changed

go/ql/integration-tests/all-platforms/go/bazel-sample-1/BUILD.bazel

Whitespace-only changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"markdownMessage": "1 bazel BUILD file was found:\n\n`BUILD.bazel`",
3+
"severity": "note",
4+
"source": {
5+
"extractorName": "go",
6+
"id": "go/autobuilder/bazel-build-file-found",
7+
"name": "Bazel BUILD files were found"
8+
},
9+
"visibility": {
10+
"cliSummaryTable": false,
11+
"statusPage": false,
12+
"telemetry": true
13+
}
14+
}
15+
{
16+
"markdownMessage": "A single `go.mod` file was found.\n\n`go.mod`",
17+
"severity": "note",
18+
"source": {
19+
"extractorName": "go",
20+
"id": "go/autobuilder/single-root-go-mod-found",
21+
"name": "A single `go.mod` file was found in the root"
22+
},
23+
"visibility": {
24+
"cliSummaryTable": false,
25+
"statusPage": false,
26+
"telemetry": true
27+
}
28+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
go 1.14
2+
3+
require (
4+
golang.org/x/net v0.0.0-20200505041828-1ed23360d12c
5+
)
6+
7+
module bazelsample
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2+
golang.org/x/net v0.0.0-20200505041828-1ed23360d12c h1:zJ0mtu4jCalhKg6Oaukv6iIkb+cOvDrajDH9DH46Q4M=
3+
golang.org/x/net v0.0.0-20200505041828-1ed23360d12c/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
4+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5+
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
6+
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
htmlFiles
2+
extractionErrors
3+
| Extraction failed in test.go with error \tother declaration of test | 2 |
4+
| Extraction failed in todel.go with error test redeclared in this block | 2 |
5+
#select
6+
| test.go:0:0:0:0 | test.go |
7+
| todel.go:0:0:0:0 | todel.go |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package bazelsample
2+
3+
import (
4+
"golang.org/x/net/ipv4"
5+
)
6+
7+
func test() {
8+
9+
header := ipv4.Header{}
10+
header.Version = 4
11+
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
3+
from create_database_utils import *
4+
from diagnostics_test_utils import *
5+
6+
run_codeql_database_create([], lang="go")
7+
8+
check_diagnostics()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import go
2+
import semmle.go.DiagnosticsReporting
3+
4+
from GoFile f
5+
select f
6+
7+
query predicate htmlFiles(HtmlFile x) { any() }
8+
9+
query predicate extractionErrors(string msg, int sev) { reportableDiagnostics(_, msg, sev) }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package bazelsample
2+
3+
import (
4+
"golang.org/x/net/ipv4"
5+
)
6+
7+
func test() {
8+
9+
header := ipv4.Header{}
10+
header.Version = 4
11+
12+
}

go/ql/integration-tests/all-platforms/go/bazel-sample-2/BUILD

Whitespace-only changes.

0 commit comments

Comments
 (0)