🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

github.com/pasataleo/go-testing

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/pasataleo/go-testing

v0.2.2
Source
Go
Version published
Created
Source

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

FAQs

Package last updated on 19 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts