Fix test cases with invalid sample code

This commit is contained in:
Grant Murphy
2017-01-13 12:40:49 -08:00
parent d3f0a08f0d
commit ab4867bc76
9 changed files with 60 additions and 41 deletions
+5 -1
View File
@@ -32,12 +32,13 @@ func TestErrorsMulti(t *testing.T) {
"fmt"
)
func test() (val int, err error) {
func test() (int,error) {
return 0, nil
}
func main() {
v, _ := test()
fmt.Println(v)
}`, analyzer)
checkTestResults(t, issues, 1, "Errors unhandled")
@@ -130,6 +131,9 @@ func TestErrorsWhitelisted(t *testing.T) {
var b bytes.Buffer
// Default whitelist
nbytes, _ := b.Write([]byte("Hello "))
if nbytes <= 0 {
os.Exit(1)
}
// Whitelisted via configuration
r, _ := zlib.NewReader(&b)