Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 673 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 673 Bytes

gotest

Wrappers for functions, in standard go packages, that return an error. The main purpose is to reduce boilerplate for error handling in tests, and make tests more readable.

The package layout is exactly the same as the standard go packages, with the same function names, but with the suffix test added to the package name.

Usage

package main_test

import (
    "testing"

    "github.com/krhubert/gotest/go/ostest"
)

func TestOpenFile(t *testing.T) {
    f := ostest.OpenFile(t, "file.txt")
    defer f.Close()
}