Skip to content

Simple utility function for running parameterized tests

License

Notifications You must be signed in to change notification settings

nitroshare/params

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

params

Build Status Coverage Status Go Reference MIT License

This package provides a simple way to run parameterized tests:

import (
    "math"
    "testing"

    "github.com/nitroshare/compare"
    "github.com/nitroshare/params"
)

func TestSquareRoot(t *testing.T) {
    type V struct {
		Name   string
        Number float64
        Root   float64
	}
	Run(
		t,
		func(t *testing.T, v *V) {
            if math.Sqrt(v.Number) != v.Root {
                t.Fatal("root doesn't match!")
            }
        },
		&V{
            Name:   "square root of nine",
            Number: 9,
            Root:   3,
        },
	)
}

This package works extremely well in conjunction with the compare package

About

Simple utility function for running parameterized tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages