Skip to content

Releases: sivchari/tenv

Apply Fuzz test.

02 Apr 05:28
Compare
Choose a tag to compare

This release handles to diagnose testing.F in Go1.18.

update linter

19 Sep 05:38
Compare
Choose a tag to compare
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

18 Sep 19:28
Compare
Choose a tag to compare
v1.3.7

fix all flag

improve report message

18 Sep 19:07
Compare
Choose a tag to compare
v1.3.6

improve report message

delete confition and force option

17 Sep 13:07
Compare
Choose a tag to compare
v1.2.6

delete condition if go version is higher than 1.17 and delete force o…

Fix report message

16 Sep 14:38
Compare
Choose a tag to compare
v1.1.6

fix report message

Add all option

16 Sep 14:16
Compare
Choose a tag to compare

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

16 Sep 06:39
Compare
Choose a tag to compare
v1.0.5

adjust function

fix panic error by out of range

16 Sep 05:59
Compare
Choose a tag to compare
v1.0.4

fix out of range panic

fix check version

06 Sep 17:15
Compare
Choose a tag to compare
v1.0.3

fix check version