本文整理匯總了Golang中github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert.True函數的典型用法代碼示例。如果您正苦於以下問題:Golang True函數的具體用法?Golang True怎麽用?Golang True使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了True函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestSet
func TestSet(t *testing.T) {
s := newStore()
// Set /foo=""
e, err := s.Set("/foo", false, "", Permanent)
assert.Nil(t, err, "")
assert.Equal(t, e.Action, "set", "")
assert.Equal(t, e.Node.Key, "/foo", "")
assert.False(t, e.Node.Dir, "")
assert.Equal(t, e.Node.Value, "", "")
assert.Nil(t, e.Node.Nodes, "")
assert.Nil(t, e.Node.Expiration, "")
assert.Equal(t, e.Node.TTL, 0, "")
assert.Equal(t, e.Node.ModifiedIndex, uint64(1), "")
// Set /foo="bar"
e, err = s.Set("/foo", false, "bar", Permanent)
assert.Nil(t, err, "")
assert.Equal(t, e.Action, "set", "")
assert.Equal(t, e.Node.Key, "/foo", "")
assert.False(t, e.Node.Dir, "")
assert.Equal(t, e.Node.Value, "bar", "")
assert.Nil(t, e.Node.Nodes, "")
assert.Nil(t, e.Node.Expiration, "")
assert.Equal(t, e.Node.TTL, 0, "")
assert.Equal(t, e.Node.ModifiedIndex, uint64(2), "")
// check prevNode
assert.NotNil(t, e.PrevNode, "")
assert.Equal(t, e.PrevNode.Key, "/foo", "")
assert.Equal(t, e.PrevNode.Value, "", "")
assert.Equal(t, e.PrevNode.ModifiedIndex, uint64(1), "")
// Set /foo="baz" (for testing prevNode)
e, err = s.Set("/foo", false, "baz", Permanent)
assert.Nil(t, err, "")
assert.Equal(t, e.Action, "set", "")
assert.Equal(t, e.Node.Key, "/foo", "")
assert.False(t, e.Node.Dir, "")
assert.Equal(t, e.Node.Value, "baz", "")
assert.Nil(t, e.Node.Nodes, "")
assert.Nil(t, e.Node.Expiration, "")
assert.Equal(t, e.Node.TTL, 0, "")
assert.Equal(t, e.Node.ModifiedIndex, uint64(3), "")
// check prevNode
assert.NotNil(t, e.PrevNode, "")
assert.Equal(t, e.PrevNode.Key, "/foo", "")
assert.Equal(t, e.PrevNode.Value, "bar", "")
assert.Equal(t, e.PrevNode.ModifiedIndex, uint64(2), "")
// Set /dir as a directory
e, err = s.Set("/dir", true, "", Permanent)
assert.Nil(t, err, "")
assert.Equal(t, e.Action, "set", "")
assert.Equal(t, e.Node.Key, "/dir", "")
assert.True(t, e.Node.Dir, "")
assert.Equal(t, e.Node.Value, "", "")
assert.Nil(t, e.Node.Nodes, "")
assert.Nil(t, e.Node.Expiration, "")
assert.Equal(t, e.Node.TTL, 0, "")
assert.Equal(t, e.Node.ModifiedIndex, uint64(4), "")
}
示例2: TestStoreCreateDirectory
// Ensure that the store can create a new directory if it doesn't already exist.
func TestStoreCreateDirectory(t *testing.T) {
s := newStore()
e, err := s.Create("/foo", true, "", false, Permanent)
assert.Nil(t, err, "")
assert.Equal(t, e.Action, "create", "")
assert.Equal(t, e.Node.Key, "/foo", "")
assert.True(t, e.Node.Dir, "")
}
示例3: TestConfigVersionFlag
// Ensures that the "version" flag can be parsed.
func TestConfigVersionFlag(t *testing.T) {
c := New()
assert.Nil(t, c.LoadFlags([]string{"-version"}), "")
assert.True(t, c.ShowVersion)
}
示例4: TestConfigAbbreviatedForceFlag
// Ensures that the abbreviated "force config" flag can be parsed.
func TestConfigAbbreviatedForceFlag(t *testing.T) {
c := New()
assert.Nil(t, c.LoadFlags([]string{"-f"}), "")
assert.True(t, c.Force)
}
示例5: TestConfigAbbreviatedHelpFlag
// Ensures that the abbreviated "help" flag can be parsed.
func TestConfigAbbreviatedHelpFlag(t *testing.T) {
c := New()
assert.Nil(t, c.LoadFlags([]string{"-h"}), "")
assert.True(t, c.ShowHelp)
}