go-test

module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: MIT

README

go-test

A lightweight dependency-free helper for writing golang tests.

codecov GoReport GoDoc build MIT License

No bells and whistles, just a very simple test helper that won't bring extra dependencies to your projects.

Sample Code

package calc

func Sum(value1, value2 int) int {
	return value1 + value2
}

Testing the Sample Code

package calc

import (
	"testing"

	"github.com/pjbgf/go-test/should"
)

func TestSum(t *testing.T) {
	assertThat := func(assumption string, value1, value2, expected int) {
		should := should.New(t)

		actual := Sum(value1, value2)

		should.BeEqual(expected, actual, assumption)
	}

	assertThat("should return 13 for 4 and 9", 4, 9, 13)
	assertThat("should return 50 for 15 and 30", 15, 35, 50)
}

License

This application is licensed under the MIT License, you may obtain a copy of it here.

Directories

Path Synopsis
Package should provide methods for testing go applications.
Package should provide methods for testing go applications.

Jump to

Keyboard shortcuts

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