Skip to content

AlekSi/xfail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xfail

Go Reference

Go package providing a testing helper for expected test failures.

XFail returns a new testing.TB instance that expects the test to fail for the given reason. At the end of the test, if it was marked as failed using non-fatal methods Fail, Error, or Errorf, it will pass instead. If it wasn't marked as failed, it will fail so that the XFail call can be removed. Fatal methods FailNow, Fatal, or Fatalf will skip the rest of the test instead.

func TestParseDuration(tt *testing.T) {
	t := XFail(tt, "https://github.com/golang/go/issues/67076")

	if _, err := time.ParseDuration("3.336e-6s"); err != nil {
		t.Fatal(err)
	}
}

See golang/go#25951 for examples of when this is helpful.

License

Copyright 2021 FerretDB Inc. Licensed under Apache License v2.0.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages