xfail

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

xfail

Go package providing testing helpers for expected tests failures.

Examples

Simple
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)
	}
}

License

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

Documentation

Overview

Package xfail provides testing helpers for expected tests failures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func XFail

func XFail(tb testing.TB, reason string) testing.TB

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 XFail call can be removed. Fatal methods FailNow, Fatal, or Fatalf will skip the rest of the test instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL