mirror of
https://github.com/go-delve/delve.git
synced 2025-11-03 05:47:34 +08:00
Inline helper code
This commit is contained in:
@ -10,12 +10,10 @@ import (
|
||||
"github.com/derekparker/delve/proctl"
|
||||
)
|
||||
|
||||
type testfunc func(p *proctl.DebuggedProcess)
|
||||
|
||||
func WithTestProcess(name string, t *testing.T, fn testfunc) {
|
||||
func WithTestProcess(name string, t *testing.T, fn func(p *proctl.DebuggedProcess)) {
|
||||
runtime.LockOSThread()
|
||||
base, err := compileTestProg(name)
|
||||
if err != nil {
|
||||
base := filepath.Base(name)
|
||||
if err := exec.Command("go", "build", "-gcflags=-N -l", "-o", base, name+".go").Run(); err != nil {
|
||||
t.Fatalf("Could not compile %s due to %s", name, err)
|
||||
}
|
||||
defer os.Remove("./" + base)
|
||||
@ -29,8 +27,3 @@ func WithTestProcess(name string, t *testing.T, fn testfunc) {
|
||||
|
||||
fn(p)
|
||||
}
|
||||
|
||||
func compileTestProg(source string) (string, error) {
|
||||
base := filepath.Base(source)
|
||||
return base, exec.Command("go", "build", "-gcflags=-N -l", "-o", base, source+".go").Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user