Categorygithub.com/pasataleo/go-testing
module
0.2.2
Repository: https://github.com/pasataleo/go-testing.git
Documentation: pkg.go.dev

# README

pasataleo/go-testing

This is my testing library. It is a work in progress.

Installation

go get github.com/pasataleo/go-testing

Usage

package main

import (
    "testing"

    "github.com/pasataleo/go-testing/tests"
)

func FunctionUnderTest(value string) string {
	return value
}

func FunctionWithErrorUnderTest(value string) (string, error) {
    return value, nil
}

func TestFunctionUnderTest(t *testing.T) {
	// First, we can test the function returns the expected value.
	tests.Execute(FunctionUnderTest("test")).Equal(t, "test")
	
	// Second, we can also automatically test the function returns no error, before validating the expected value.
	tests.Execute2E(FunctionWithErrorUnderTest("test")).NoError(t).Equal(t, "test")
}

# Packages

No description provided by the author