本文整理汇总了Golang中github.com/stretchrcom/testify/assert.False函数的典型用法代码示例。如果您正苦于以下问题:Golang False函数的具体用法?Golang False怎么用?Golang False使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了False函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Test_ASTInline_Equal
func Test_ASTInline_Equal(t *testing.T) {
node1 := &ASTInline{}
node2 := &ASTInline{}
assert.True(t, node1.Equal(node1),
"ASTInline not equal to itself")
assert.True(t, node1.Equal(node2),
"empty ASTInlines not equal")
node1.lang = "foo"
node2.lang = "bar"
assert.False(t, node1.Equal(node2),
"ASTInlines equal despite different lang")
node2.lang = "foo"
assert.True(t, node1.Equal(node2),
"ASTInlines not equal")
node1.content = "hello\nworld\n"
node2.content = "hello\nworld"
assert.False(t, node1.Equal(node2),
"ASTInlines equal despite different content")
node2.content += "\n"
assert.True(t, node1.Equal(node2),
"ASTInlines not equal")
}
示例2: Test_ListNode_basics
func Test_ListNode_basics(t *testing.T) {
node0 := NewStubNode("foo")
node1 := NewStubNode("bar baz")
node2 := NewStubNode("qux")
list1 := newListNode(node0, node1, node2)
assert.Equal(t, "ListNode", list1.Typename())
assert.Equal(t, "foo,bar baz,qux", list1.Name())
assert.Equal(t, `["foo", "bar baz", "qux"]`, list1.String())
assert.Equal(t, "foo,bar baz,qux", list1.ValueString())
assert.Equal(t, "foo 'bar baz' qux", list1.CommandString())
expect1 := []types.FuObject{node0, node1, node2}
assert.Equal(t, expect1, list1.List())
expect2 := []Node{node0, node1, node2}
assert.Equal(t, expect2, list1.Nodes())
list2 := newListNode(node0, node1, node2)
assert.True(t, list1.Equal(list2))
list3 := newListNode(node1, node0, node2)
assert.False(t, list1.Equal(list3))
list4 := list3.copy().(*ListNode)
assert.False(t, list3 == list4)
assert.True(t, list3.Equal(list4))
}
示例3: TestGame_IsOver
func TestGame_IsOver(t *testing.T) {
var game Game = NewGame()
var board = game.Board()
t.Log("New Game is not over")
assert.False(t, game.IsOver())
t.Log("Game with two-in-a-row is not over")
AddMarks(board, "X", 4, 8)
assert.False(t, game.IsOver())
t.Log("Game with three-in-a-row \"X\" is over")
board.Mark(0, "X")
assert.True(t, game.IsOver())
t.Log("Game with three-in-a-row \"O\" is over")
board.Reset()
AddMarks(board, "O", 2, 4, 6)
assert.True(t, game.IsOver())
t.Log("Game with three-in-a-row mismatched is not over")
board.Mark(2, "X")
assert.False(t, game.IsOver())
t.Log("Game with nearly-full, non-winning board is not over")
board.Reset()
AddMarks(board, "X", 0, 1, 4, 5)
AddMarks(board, "O", 2, 3, 7, 8)
assert.False(t, game.IsOver())
t.Log("Game with full, non-winning board is over")
board.Mark(6, "X")
assert.True(t, game.IsOver())
}
示例4: TestSpResult
func TestSpResult(t *testing.T) {
r := NewSpResult()
assert.Equal(t, -1, r.status)
assert.Equal(t, -1, r.currentResult)
assert.False(t, r.HasOutputParams())
assert.False(t, r.HasResults())
assert.False(t, r.NextResult())
assert.Nil(t, r.Result())
}
示例5: Test_ValueMap_basics
func Test_ValueMap_basics(t *testing.T) {
ns := NewValueMap()
val, ok := ns.Lookup("foo")
assert.False(t, ok)
val, ok = ns.Lookup("bar")
assert.False(t, ok)
ns.Assign("foo", MakeFuString("blurp"))
val, ok = ns.Lookup("foo")
assert.True(t, ok)
assert.Equal(t, "blurp", val.ValueString())
val, ok = ns.Lookup("bar")
assert.False(t, ok)
}
示例6: TestSetMasks
func TestSetMasks(t *testing.T) {
m := new(Masks)
assert.False(t, m.Grayscale)
m.Set(0x01)
assert.True(t, m.Grayscale)
assert.False(t, m.ShowBackgroundLeft)
m.Set(0x02)
assert.True(t, m.ShowBackgroundLeft)
assert.False(t, m.ShowSpritesLeft)
m.Set(0x04)
assert.True(t, m.ShowSpritesLeft)
assert.False(t, m.ShowBackground)
m.Set(0x08)
assert.True(t, m.ShowBackground)
assert.False(t, m.ShowSprites)
m.Set(0x10)
assert.True(t, m.ShowSprites)
assert.False(t, m.IntenseReds)
m.Set(0x20)
assert.True(t, m.IntenseReds)
assert.False(t, m.IntenseGreens)
m.Set(0x40)
assert.True(t, m.IntenseGreens)
assert.False(t, m.IntenseBlues)
m.Set(0x80)
assert.True(t, m.IntenseBlues)
}
示例7: Test_FinderNode_Add_CommandString
// hmmmm: interface-wise, this tests that FinderNode.Add() returns an
// object whose CommandString() behaves sensibly... but in
// implementation terms, it's really a test of FuList.CommandString()
func Test_FinderNode_Add_CommandString(t *testing.T) {
finder1 := NewFinderNode("*.c", "*.h")
finder2 := NewFinderNode("doc/???.txt")
finder3 := NewFinderNode()
sum1, err := finder1.Add(finder2)
assert.Nil(t, err)
assert.Equal(t, "'*.c' '*.h' 'doc/???.txt'", sum1.CommandString())
sum2, err := finder3.Add(sum1)
assert.Nil(t, err)
assert.Equal(t, "'*.c' '*.h' 'doc/???.txt'", sum2.CommandString())
assert.False(t, sum1.Equal(sum2))
sum2b, err := finder3.Add(sum1)
assert.Nil(t, err)
assert.True(t, sum2.Equal(sum2b),
"expected equal ListNodes:\nsum2 = %T %v\nsum2b = %T %v",
sum2, sum2, sum2b, sum2b)
// This is a silly thing to do, and perhaps we should filter out
// the duplicate patterns... but I don't think so. If the user
// constructs something silly, we do something silly.
sum3, err := sum1.Add(sum2)
assert.Nil(t, err)
assert.Equal(t,
"'*.c' '*.h' 'doc/???.txt' '*.c' '*.h' 'doc/???.txt'",
sum3.CommandString())
}
示例8: TestConnect
func TestConnect(t *testing.T) {
conn := ConnectToTestDb(t)
assert.NotNil(t, conn)
defer conn.Close()
assert.True(t, conn.isLive())
assert.False(t, conn.isDead())
}
示例9: TestMapStaticFile
func TestMapStaticFile(t *testing.T) {
codecService := new(codecservices.WebCodecService)
h := NewHttpHandler(codecService)
h.MapStaticFile("/static-file", "/location/of/static-file")
assert.Equal(t, 1, len(h.HandlersPipe()))
staticHandler := h.HandlersPipe()[0].(*PathMatchHandler)
if assert.Equal(t, 1, len(staticHandler.HttpMethods)) {
assert.Equal(t, goweb_http.MethodGet, staticHandler.HttpMethods[0])
}
var ctx context.Context
var willHandle bool
ctx = context_test.MakeTestContextWithPath("/static-file")
willHandle, _ = staticHandler.WillHandle(ctx)
assert.True(t, willHandle, "Static handler should handle")
ctx = context_test.MakeTestContextWithPath("static-file")
willHandle, _ = staticHandler.WillHandle(ctx)
assert.True(t, willHandle, "Static handler should handle")
ctx = context_test.MakeTestContextWithPath("static-file/")
willHandle, _ = staticHandler.WillHandle(ctx)
assert.True(t, willHandle, "Static handler should handle")
ctx = context_test.MakeTestContextWithPath("static-file/something-else")
willHandle, _ = staticHandler.WillHandle(ctx)
assert.False(t, willHandle, "Static handler NOT should handle")
}
示例10: AssertNotCalled
// AssertNotCalled asserts that the method was not called.
func (m *Mock) AssertNotCalled(t *testing.T, methodName string, arguments ...interface{}) bool {
if !assert.False(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method was called with %d argument(s), but should NOT have been.", methodName, len(arguments))) {
t.Logf("%s", m.ExpectedCalls)
return false
}
return true
}
示例11: TestPathMatchHandler_BreakCurrentPipeline
func TestPathMatchHandler_BreakCurrentPipeline(t *testing.T) {
pathPattern, _ := paths.NewPathPattern("collection/{id}/name")
h := NewPathMatchHandler(pathPattern, HandlerExecutionFunc(func(c context.Context) error {
return nil
}))
h.BreakCurrentPipeline = true
ctx1 := context_test.MakeTestContextWithPath("/collection/123/name")
breakCurrentPipeline, _ := h.Handle(ctx1)
assert.True(t, breakCurrentPipeline)
h = NewPathMatchHandler(pathPattern, HandlerExecutionFunc(func(c context.Context) error {
return nil
}))
h.BreakCurrentPipeline = false
ctx1 = context_test.MakeTestContextWithPath("/collection/123/name")
breakCurrentPipeline, _ = h.Handle(ctx1)
assert.False(t, breakCurrentPipeline)
}
示例12: TestInterruptingNMISetsNMI
func TestInterruptingNMISetsNMI(t *testing.T) {
p := NewCPU()
assert.False(t, p.nmi.Occurred)
p.Interrupt(NMI)
assert.True(t, p.nmi.Occurred)
}
示例13: Test_BuiltinList
func Test_BuiltinList(t *testing.T) {
blist := BuiltinList{}
fn, ok := blist.Lookup("foo")
assert.False(t, ok)
assert.Nil(t, fn)
callable := types.NewFixedFunction("foo", 3, nil)
blist.builtins = append(blist.builtins, callable)
fn, ok = blist.Lookup("foo")
assert.True(t, ok)
assert.Equal(t, callable, fn)
blist.builtins = append(
blist.builtins, types.NewFixedFunction("bar", 0, nil))
blist.builtins = append(
blist.builtins, types.NewFixedFunction("bop", 0, nil))
blist.builtins = append(
blist.builtins, types.NewFixedFunction("bam", 0, nil))
blist.builtins = append(
blist.builtins, types.NewFixedFunction("pow", 0, nil))
assert.Equal(t, 5, blist.NumBuiltins())
actual := make([]string, 0, 5)
visit := func(name string, code types.FuObject) error {
actual = append(actual, name)
if name == "bam" {
return errors.New("bam!")
}
return nil
}
err := blist.ForEach(visit)
assert.Equal(t, []string{"foo", "bar", "bop", "bam"}, actual)
assert.Equal(t, "bam!", err.Error())
}
示例14: test_AccessChannel
func test_AccessChannel(t *testing.T, err_msg string, timer NetAccessRule, timeout time.Duration) (err error) {
timeout_chan := make(chan struct{}, 1)
timeout_func := func() {
time.Sleep(timeout)
close(timeout_chan)
}
go timeout_func()
i := 0
for i < 5 {
access_chan := timer.AccessChannel()
break_loop := false
for !break_loop {
select {
case <-timeout_chan:
return errors.New(fmt.Sprintf("Access channel timed out at iteration %i", i))
case _, ok := <-access_chan:
assert.False(t, ok, err_msg)
i++
break_loop = true
}
}
}
return nil
}
示例15: Test_FuString_Lookup
func Test_FuString_Lookup(t *testing.T) {
// strings have no attributes
s := MakeFuString("blah")
val, ok := s.Lookup("foo")
assert.Nil(t, val)
assert.False(t, ok)
}