aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-linter/testdata/src
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-04-16 16:35:18 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-04-17 13:48:18 +0000
commitacc528cbf40c42eb112d2ce66c5f778bd4a397fb (patch)
tree1db39cbb9517df790fdf189d3bd1f59e4b7a8b0c /tools/syz-linter/testdata/src
parent18f6e127bf6e515fc3eee0936bde2415e676e160 (diff)
tools/syz-linter: check t.Logf/Errorf/Fatalf messages
Fix checking of Logf, it has string in 0-th arg. Add checking of t.Errorf/Fatalf.
Diffstat (limited to 'tools/syz-linter/testdata/src')
-rw-r--r--tools/syz-linter/testdata/src/lintertest/lintertest.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/syz-linter/testdata/src/lintertest/lintertest.go b/tools/syz-linter/testdata/src/lintertest/lintertest.go
index 51700726e..c6ba8ba8f 100644
--- a/tools/syz-linter/testdata/src/lintertest/lintertest.go
+++ b/tools/syz-linter/testdata/src/lintertest/lintertest.go
@@ -8,6 +8,7 @@ import (
"fmt"
"log"
"os"
+ "testing"
)
/* some comment */ // want "Use C-style comments // instead of /* */"
@@ -100,6 +101,14 @@ func logErrorMessages() {
fmt.Fprintf(os.Stderr, "%v", err) // want "Add \\\\n at the end of printed messages"
}
+func testMessages(t *testing.T) {
+ t.Logf("good message %v", 1)
+ t.Logf("Bad message %v", 1) // want "Don't start log/error messages with a Capital letter"
+ t.Errorf("bad message %v\n", 1) // want "Don't use \\\\n at the end of log/error messages"
+ t.Fatalf("Bad message %v", 1) // want "Don't start log/error messages with a Capital letter"
+ t.Fatalf("PublicFunc is ok %v", 1)
+}
+
func varDecls() {
var a int
b := 0