本文整理匯總了Golang中fubsy/types.FuObject.String方法的典型用法代碼示例。如果您正苦於以下問題:Golang FuObject.String方法的具體用法?Golang FuObject.String怎麽用?Golang FuObject.String使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fubsy/types.FuObject
的用法示例。
在下文中一共展示了FuObject.String方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Test_BuildRule_setLocals
func Test_BuildRule_setLocals(t *testing.T) {
targets := []dag.Node{dag.NewStubNode("foo")}
sources := []dag.Node{dag.NewStubNode("bar"), dag.NewStubNode("qux")}
ns := types.NewValueMap()
rule := NewBuildRule(nil, targets, sources)
rule.setLocals(ns)
var val types.FuObject
var ok bool
val, ok = ns.Lookup("whatever")
assert.False(t, ok)
val, ok = ns.Lookup("target")
assert.False(t, ok)
val, ok = ns.Lookup("targets")
assert.False(t, ok)
val, ok = ns.Lookup("TARGET")
assert.True(t, ok)
assert.Equal(t, "foo", val.ValueString())
assert.Equal(t, "foo", val.(*dag.StubNode).Name())
val, ok = ns.Lookup("SOURCE")
assert.True(t, ok)
assert.Equal(t, "bar", val.ValueString())
assert.Equal(t, "bar", val.(*dag.StubNode).Name())
val, ok = ns.Lookup("TARGETS")
assert.True(t, ok)
assert.Equal(t, 1, len(val.List()))
assert.Equal(t, `["foo"]`, val.String())
val, ok = ns.Lookup("SOURCES")
assert.True(t, ok)
assert.Equal(t, 2, len(val.List()))
assert.Equal(t, `["bar", "qux"]`, val.String())
}
示例2: Test_FinderNode_String
func Test_FinderNode_String(t *testing.T) {
var finder types.FuObject
finder = &FinderNode{includes: []string{"*.c", "**/*.h"}}
assert.Equal(t, "<*.c **/*.h>", finder.String())
}