Releases: sivchari/tenv
Releases · sivchari/tenv
Apply Fuzz test.
This release handles to diagnose testing.F in Go1.18.
update linter
package main
import (
"os"
"testing"
)
var (
ee = os.Setenv("a", "b") // never seen
)
func setup() {
os.Setenv("a", "b") // never seen
err := os.Setenv("a", "b") // never seen
if err != nil {
_ = err
}
os.Setenv("a", "b") // never seen
}
func F(t *testing.T) {
setup()
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in F"
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in F"
_ = err
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in F"
_ = err
}
}
func BF(b *testing.B) {
TBF(b)
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BF"
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BF"
_ = err
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BF"
_ = err
}
}
func TBF(tb testing.TB) {
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TBF"
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TBF"
_ = err
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TBF"
_ = err
}
}
package main_test
import (
"os"
"testing"
)
var (
e = os.Setenv("a", "b") // never seen
)
func testsetup() {
os.Setenv("a", "b") // if -all = true, want "os\\.Setenv\\(\\) can be replaced by `testing\\.Setenv\\(\\)` in testsetup"
err := os.Setenv("a", "b") // if -all = true, want "os\\.Setenv\\(\\) can be replaced by `testing\\.Setenv\\(\\)` in testsetup"
if err != nil {
_ = err
}
os.Setenv("a", "b") // if -all = true, "func setup is not using testing.Setenv"
}
func TestF(t *testing.T) {
testsetup()
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in TestF"
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in TestF"
_ = err
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in TestF"
_ = err
}
}
func BenchmarkF(b *testing.B) {
TB(b)
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BenchmarkF"
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BenchmarkF"
_ = err
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BenchmarkF"
_ = err
}
}
func TB(tb testing.TB) {
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TB"
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TB"
_ = err
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TB"
_ = err
}
}
fix all flag
v1.3.7 fix all flag
improve report message
v1.3.6 improve report message
delete confition and force option
v1.2.6 delete condition if go version is higher than 1.17 and delete force o…
Fix report message
v1.1.6 fix report message
Add all option
You can use all to check all methods.
By default, only methods that take *testing.T, *testing.B, and testing.TB as arguments are checked.
adjust package
v1.0.5 adjust function
fix panic error by out of range
v1.0.4 fix out of range panic
fix check version
v1.0.3 fix check version