subtest

package
v0.0.0-...-c012b7a Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package subtest provides a backwards-compatible way to run subtests.

For Go 1.7 and higher, it uses testing.T's run method. For lower versions it mimics subtests by logging additional information.

package foo

import "github.com/mpvl/subtest"

var testCases = ...

func TestFoo(t *testing.T) {
    for _, tc := range testCases {
        subtest.Run(t, tc.name, func(t *testing.T) {
            tc.doTest()
        })
    }
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, name string, f func(t *testing.T))

Run runs function f as a subtest of t.

Types

This section is empty.

Jump to

Keyboard shortcuts

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