package pkg

import (
	"fmt"
	"log"
	"os"
	"testing"
)

func fn(s string) {
	fn2 := func() string { return "" }
	fmt.Print(fn2())      //@ diag(`should use print-style function`)
	_ = fmt.Sprint(fn2()) //@ diag(`should use print-style function`)
	log.Print(fn2())      //@ diag(`should use print-style function`)
	fmt.Print(s)          //@ diag(`should use print-style function`)
	fmt.Printf(s, "")
	fmt.Fprint(os.Stdout, s) //@ diag(`should use print-style function`)
	fmt.Fprintf(os.Stdout, s, "")

	fmt.Printf(fn2(), "")
	fmt.Printf("")
	fmt.Printf("%s", "")
	fmt.Printf(fn3())

	l := log.New(os.Stdout, "", 0)
	l.Printf("xx: %q", "yy")
	l.Print(s) //@ diag(`should use print-style function`)

	var t testing.T
	t.Log(fn2()) //@ diag(`should use print-style function`)
	t.Error(s)   //@ diag(`should use print-style function`)
	t.Fatal(s)   //@ diag(`should use print-style function`)
	t.Skip(s)    //@ diag(`should use print-style function`)

	var b testing.B
	b.Log(fn2()) //@ diag(`should use print-style function`)
	b.Error(s)   //@ diag(`should use print-style function`)
	b.Fatal(s)   //@ diag(`should use print-style function`)
	b.Skip(s)    //@ diag(`should use print-style function`)

	var tb testing.TB
	tb.Log(fn2()) //@ diag(`should use print-style function`)
	tb.Error(s)   //@ diag(`should use print-style function`)
	tb.Fatal(s)   //@ diag(`should use print-style function`)
	tb.Skip(s)    //@ diag(`should use print-style function`)

	errors.New(s) //@ diag(`should use print-style function`)

	var nested struct {
		l log.Logger
	}
	nested.l.Print(s) //@ diag(`should use print-style function`)
}

func fn3() (string, int) { return "", 0 }
