當前位置: 首頁>>代碼示例>>Golang>>正文


Golang test.BuildFixture函數代碼示例

本文整理匯總了Golang中github.com/derekparker/delve/proc/test.BuildFixture函數的典型用法代碼示例。如果您正苦於以下問題:Golang BuildFixture函數的具體用法?Golang BuildFixture怎麽用?Golang BuildFixture使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BuildFixture函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: withTestTerminal

func withTestTerminal(name string, t testing.TB, fn func(*FakeTerminal)) {
	os.Setenv("TERM", "dumb")
	listener, err := net.Listen("tcp", "localhost:0")
	if err != nil {
		t.Fatalf("couldn't start listener: %s\n", err)
	}
	defer listener.Close()
	server := rpc2.NewServer(&service.Config{
		Listener:    listener,
		ProcessArgs: []string{test.BuildFixture(name).Path},
	}, false)
	if err := server.Run(); err != nil {
		t.Fatal(err)
	}
	client := rpc2.NewClient(listener.Addr().String())
	defer func() {
		client.Detach(true)
	}()

	ft := &FakeTerminal{
		t:    t,
		Term: New(client, nil),
	}
	fn(ft)
}
開發者ID:DuoSoftware,項目名稱:v6engine-deps,代碼行數:25,代碼來源:command_test.go

示例2: withTestProcess

func withTestProcess(name string, t *testing.T, fn func(p *Process, fixture protest.Fixture)) {
	fixture := protest.BuildFixture(name)
	p, err := Launch([]string{fixture.Path})
	if err != nil {
		t.Fatal("Launch():", err)
	}

	defer func() {
		p.Halt()
		p.Detach(true)
	}()

	fn(p, fixture)
}
開發者ID:no2key,項目名稱:delve,代碼行數:14,代碼來源:proc_test.go

示例3: withTestProcessArgs

func withTestProcessArgs(name string, t testing.TB, fn func(p *Process, fixture protest.Fixture), args []string) {
	fixture := protest.BuildFixture(name)
	p, err := Launch(append([]string{fixture.Path}, args...))
	if err != nil {
		t.Fatal("Launch():", err)
	}

	defer func() {
		p.Halt()
		p.Kill()
	}()

	fn(p, fixture)
}
開發者ID:xingxing17,項目名稱:delve,代碼行數:14,代碼來源:proc_test.go

示例4: withTestClient

func withTestClient(name string, t *testing.T, fn func(c service.Client)) {
	listener, err := net.Listen("tcp", "localhost:0")
	if err != nil {
		t.Fatalf("couldn't start listener: %s\n", err)
	}
	defer listener.Close()
	server := rpc.NewServer(&service.Config{
		Listener:    listener,
		ProcessArgs: []string{protest.BuildFixture(name).Path},
	}, false)
	if err := server.Run(); err != nil {
		t.Fatal(err)
	}
	client := rpc.NewClient(listener.Addr().String())
	defer func() {
		client.Detach(true)
	}()

	fn(client)
}
開發者ID:yigen520,項目名稱:delve,代碼行數:20,代碼來源:integration_test.go


注:本文中的github.com/derekparker/delve/proc/test.BuildFixture函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。