当前位置: 首页>>代码示例>>Golang>>正文


Golang T.Skipped方法代码示例

本文整理汇总了Golang中testing.T.Skipped方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Skipped方法的具体用法?Golang T.Skipped怎么用?Golang T.Skipped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testing.T的用法示例。


在下文中一共展示了T.Skipped方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestWriteExtraInvalid

func TestWriteExtraInvalid(t *testing.T) {
	src := `
  [foo]
  hello=world
  `
	src2 := `
	[foo]
	goodbye=all
	herp?
	other=data
	`

	expBytes := 27
	file, err := Load(strings.NewReader(src))
	if err != nil {
		t.Skipped()
	}

	n, err := file.Write([]byte(src2))
	if n != expBytes {
		t.Errorf("Expected to write %d bytes, got %d", expBytes, n)
	}
	if err == nil {
		t.Errorf("Expected an error on partial write, got none")
	}

	check := func(section, key, expect string) {
		checkStr(t, file, section, key, expect)
	}

	check("foo", "hello", "world")
	check("foo", "goodbye", "all")
}
开发者ID:dombenson,项目名称:go-ini,代码行数:33,代码来源:ini_test.go

示例2: TestWriteExtra

func TestWriteExtra(t *testing.T) {
	src := `
  [foo]
  hello=world
  `
	src2 := `
	[foo]
	goodbye=all
	[bar]
	other=data
	`

	expBytes := len(src2)
	file, err := Load(strings.NewReader(src))
	if err != nil {
		t.Skipped()
	}

	n, err := file.Write([]byte(src2))
	if n != expBytes {
		t.Errorf("Expected to write %d bytes, got %d", expBytes, n)
	}

	check := func(section, key, expect string) {
		checkStr(t, file, section, key, expect)
	}

	check("foo", "hello", "world")
	check("foo", "goodbye", "all")
	check("bar", "other", "data")
}
开发者ID:dombenson,项目名称:go-ini,代码行数:31,代码来源:ini_test.go

示例3: initTestServer

func initTestServer(t *testing.T) (*testutil.TestServer, *api.Client) {
	if testing.Short() {
		t.Skip("skipping test dependent on consul because of short mode")
	}
	defer func() {
		// if consul is not in the $PATH, NewTestServer will skip the test,
		// which should be treated as an error
		if t.Skipped() {
			t.Error("failing skipped test")
		}
	}()
	server := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {
		ports := getPorts(t, 6)
		c.Ports = &testutil.TestPortConfig{
			DNS:     ports[0],
			HTTP:    ports[1],
			RPC:     ports[2],
			SerfLan: ports[3],
			SerfWan: ports[4],
			Server:  ports[5],
		}
	})
	client, err := api.NewClient(&api.Config{
		Address: server.HTTPAddr,
	})
	if err != nil {
		t.Fatal(err)
	}
	return server, client
}
开发者ID:tomzhang,项目名称:p2,代码行数:30,代码来源:watch_test.go

示例4: dependOn

func dependOn(t *testing.T, deps ...func(*testing.T)) {
	for _, dependancy := range deps {
		dependancy(t)

		if t.Skipped() || t.Failed() {
			t.Skip("Dependency failed, Skipping.")
		}
	}
}
开发者ID:Ryman,项目名称:intstab,代码行数:9,代码来源:intstab_test.go

示例5: dependOn

func dependOn(t *testing.T, deps ...func(*testing.T)) {
	// stops things getting logged into other test logs
	temp := new(testing.T)
	for _, dependancy := range deps {
		dependancy(temp)

		if temp.Skipped() || temp.Failed() {
			t.Skip("Dependency failed, Skipping.")
		}
	}
}
开发者ID:azadi,项目名称:check,代码行数:11,代码来源:datastore_test.go

示例6: makeStore

func makeStore(t *testing.T) (kp.Store, *testutil.TestServer) {
	if testing.Short() {
		t.Skip("skipping test dependendent on consul because of short mode")
	}

	// testutil.NewTestServerConfig will skip the test if "consul" isn't in the system path.
	// We'd rather the test fail.
	defer func() {
		if t.Skipped() {
			t.Fatalf("test skipped by testutil package")
		}
	}()

	// Create server
	server := testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {
		// consul output in test output is noisy
		c.Stdout = ioutil.Discard
		c.Stderr = ioutil.Discard

		// If ports are left to their defaults, this test conflicts
		// with the test consul servers in pkg/kp
		var offset uint64
		idx := int(atomic.AddUint64(&offset, 1))
		c.Ports = &testutil.TestPortConfig{
			DNS:     26000 + idx,
			HTTP:    27000 + idx,
			RPC:     28000 + idx,
			SerfLan: 29000 + idx,
			SerfWan: 30000 + idx,
			Server:  31000 + idx,
		}
	})

	client := kp.NewConsulClient(kp.Options{
		Address: server.HTTPAddr,
	})
	store := kp.NewConsulStore(client)
	return store, server
}
开发者ID:tomzhang,项目名称:p2,代码行数:39,代码来源:common_test_setup.go

示例7: NewConsulTestFixture

// Create a new test fixture that spins up a local Consul server.
func NewConsulTestFixture(t *testing.T) *ConsulTestFixture {
	if testing.Short() {
		t.Skip("skipping test dependent on consul because of short mode")
	}

	// testutil.NewTestServerConfig will skip the test if "consul" isn't in the system path.
	// We'd rather the test fail.
	defer func() {
		if t.Skipped() {
			t.Error("failing skipped test")
		}
	}()
	server := testutil.NewTestServer(t)
	client := NewConsulClient(Options{
		Address: server.HTTPAddr,
	})
	store := NewConsulStore(client)
	return &ConsulTestFixture{
		TestServer: server,
		Store:      store,
		Client:     client,
		T:          t,
	}
}
开发者ID:tomzhang,项目名称:p2,代码行数:25,代码来源:fixtures_test.go

示例8: TestAddPatternsFromPathFileOpenErr

func TestAddPatternsFromPathFileOpenErr(t *testing.T) {
	t.Skipped()
}
开发者ID:PengLiu,项目名称:grok,代码行数:3,代码来源:grok_test.go


注:本文中的testing.T.Skipped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。