frankban / quicktest

Quick helpers for testing Go applications
MIT License
529 stars 27 forks source link

WIP: add support for registering source files #100

Open rogpeppe opened 3 years ago

rogpeppe commented 3 years ago

Note: WORK IN PROGRESS

From an idea from Brad Fitzpatrick, this makes it possible to show source code in test failures even when the source code isn't currently available.

Still to do: the quicktest-generate command, which would generate code looking something like the following:

package {{.Pkg}}

import (
    "embed"
    "testing"

    qt "github.com/frankban/quicktest"
)

//go:embed *_test.go
var _quicktestFiles embed.FS

func init() {
    qt.RegisterSource({{.Package}}, _quicktestFiles)
}