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


Golang flux.LogPassed函數代碼示例

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


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

示例1: TestGoodFileParser

func TestGoodFileParser(t *testing.T) {
	ps := NewParser(DefaultInspectionFactory)

	fs, err := os.Open("./../fixtures/dataset.dq")

	if err != nil {
		flux.FatalFailed(t, "File.Error occured: %+s", err)
	}

	g, err := ps.Scan(fs)

	if err != nil {
		flux.FatalFailed(t, "Parser.Error: ", err)
	}

	flux.LogPassed(t, "Generated query graph successfully: %t", g != nil)

	itr, err := ds.CreateGraphTransversor(ds.DFPreOrderDirective(nil, nil))

	if err != nil {
		flux.FatalFailed(t, "Transverso.Error occured: %+s", err)
	}

	itr.Use(g.Get("user"))

	for itr.Next() == nil {
		node := itr.Node().(*ParseNode)
		t.Logf("Node-Attr: %s %+s", node.Name(), node.Attr)
		t.Logf("Node-Record: %s %+s", node.Name(), node.Records.Keys())
		t.Logf("Node-Rules: %s %+s", node.Name(), node.Rules)
	}

	flux.LogPassed(t, "Graph Iterator works properly")
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:34,代碼來源:parser_test.go

示例2: TestModelPassAndFailure

// TestModelPassAndFailure sets up a new map model and validates that the wrong data fails
func TestModelPassAndFailure(t *testing.T) {

	mo := NewModels(map[string]interface{}{
		"name": "",
		"age":  0,
		"date": time.Now(),
	})

	key, err := mo.Validate(map[string]interface{}{
		"name": "alex ewetumo",
		"age":  20,
		"date": time.Now(),
	})

	if err != nil {
		flux.FatalFailed(t, "Validation key failed: %s : %s", key, err.Error())
	}

	flux.LogPassed(t, "Validation passed!")

	key, err = mo.Validate(map[string]interface{}{
		"name": "alex ewetumo",
		"age":  20,
		"date": time.Duration(300) * time.Minute,
	})

	if err == nil {
		flux.FatalFailed(t, "Validation key did not failed: %s", "date")
	}

	flux.LogPassed(t, "Validation failed as expected: %s : %s", key, err.Error())
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:33,代碼來源:models_test.go

示例3: TestJSDirBundler

func TestJSDirBundler(t *testing.T) {
	js, jsmap, err := session.BuildDir("./js", "github.com/influx6/reactors/builders/base", "base")

	if err != nil {
		flux.FatalFailed(t, "Error build gopherjs dir: %s", err)
	}

	if jsmap.Len() > 50 {
		flux.LogPassed(t, "Successfully built js.map package: %d", jsmap.Len())
	}

	if js.Len() > 50 {
		flux.LogPassed(t, "Successfully built js package: %d", js.Len())
	}
}
開發者ID:influx6,項目名稱:reactors,代碼行數:15,代碼來源:js_test.go

示例4: TestMarkdown

func TestMarkdown(t *testing.T) {
	ws := new(sync.WaitGroup)
	ws.Add(1)

	mark := BlackFriday()

	mark.React((func(root flux.Reactor, err error, data interface{}) {
		if err != nil {
			flux.FatalFailed(t, "Error  occured %+s", err)
		}
		if rf, ok := data.(*RenderFile); ok {
			flux.LogPassed(t, "Markdown Rendered: %+s", rf.Data)
		} else {
			flux.FatalFailed(t, "Failure in receiving Correct Response: %+s", data)
		}
		ws.Done()
	}), true)

	mark.Send(&RenderFile{
		Path: "./slug.md",
		Data: []byte("# Slug Passive Aggressive -> SPA"),
	})

	ws.Wait()
	mark.Close()
}
開發者ID:influx6,項目名稱:reactors,代碼行數:26,代碼來源:builder_test.go

示例5: TestModelFileParser

func TestModelFileParser(t *testing.T) {
	ps := NewParser(DefaultInspectionFactory)

	fs, err := os.Open("./../fixtures/models.dq")

	if err != nil {
		flux.FatalFailed(t, "File.Error occured: %+s", err)
	}

	g, err := ps.Scan(fs)

	if err != nil {
		flux.FatalFailed(t, "Parser.Error occured: %+s", err)
	}

	itr, err := ds.CreateGraphTransversor(ds.DFPreOrderDirective(nil, nil))

	if err != nil {
		t.Fatal(err)
	}

	itr.Use(g.Get("user"))

	for itr.Next() == nil {
		node := itr.Node().(*ParseNode)
		t.Logf("Node-Attr: %s %+s", node.Name(), node.Attr)
		t.Logf("Node-Record: %s %+s", node.Name(), node.Records.Keys())
		t.Logf("Node-Rules: %s %+s", node.Name(), node.Rules)
	}

	flux.LogPassed(t, "Successfully passed model query file properly")
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:32,代碼來源:parser_test.go

示例6: TestMarkFriday

func TestMarkFriday(t *testing.T) {
	ws := new(sync.WaitGroup)
	ws.Add(1)

	mark := MarkFriday(MarkConfig{
		SaveDir: "../fixtures/templates",
		Ext:     ".mdr",
	})

	mark.React((func(root flux.Reactor, err error, data interface{}) {
		if err != nil {
			flux.FatalFailed(t, "Error  occured %+s", err)
		}

		if rf, ok := data.(*fs.FileWrite); ok {
			flux.LogPassed(t, "Markdown Rendered: %+s -> %+s", rf.Data, rf)
		} else {
			flux.FatalFailed(t, "Failure in receiving Correct Response: %+s", data)
		}
		ws.Done()
	}), true)

	mark.Send("../fixtures/markdown/base.md")

	ws.Wait()
	mark.Close()
}
開發者ID:influx6,項目名稱:reactors,代碼行數:27,代碼來源:builder_test.go

示例7: TestChunkScannerWithSinglePack

func TestChunkScannerWithSinglePack(t *testing.T) {
	var ws sync.WaitGroup
	ws.Add(1)

	fs := ChunkFileScanAdaptor()

	fs.React(func(rs flux.Reactor, err error, data interface{}) {
		ws.Done()
		if err != nil {
			flux.FatalFailed(t, "Error occured string: %v", err.Error())
		}

		if _, ok := data.(string); !ok {
			t.Fatalf("Expected type string: %v", data)
		}

		flux.LogPassed(t, "Completed with scanning on SinglePack file")
	}, true)

	fs.Send("./../fixtures/dataset.dq")

	ws.Wait()

	fs.Close()
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:25,代碼來源:adapters_test.go

示例8: TestTemplateDir

func TestTemplateDir(t *testing.T) {
	dir := NewTemplateDir(&TemplateConfig{
		Dir:       "./fixtures",
		Extension: ".tmpl",
	})

	dirs := []string{"base"}

	asst, err := dir.Create("base.tmpl", dirs, nil)

	if err != nil {
		flux.FatalFailed(t, "Failed to load: %s", err.Error())
	}

	if len(asst.Funcs) < 1 {
		flux.FatalFailed(t, "AssetTemplate Func map is empty")
	}

	buf := bytes.NewBuffer([]byte{})

	do := &dataPack{
		Name:  "alex",
		Title: "flabber",
	}

	err = asst.Tmpl.ExecuteTemplate(buf, "base", do)

	if err != nil {
		flux.FatalFailed(t, "Unable to exec templates: %+s", err)
	}

	flux.LogPassed(t, "Loaded Template succesfully")
}
開發者ID:influx6,項目名稱:assets,代碼行數:33,代碼來源:assets_test.go

示例9: TestQuero

func TestQuero(t *testing.T) {
	db, err := sql.Open("mysql", "root:@tcp(localhost:3306)/test")

	if err != nil {
		flux.FatalFailed(t, "Creating sql connection: %+s", err)
	}

	defer db.Close()

	prepareTable(t, db)

	var ws sync.WaitGroup
	ws.Add(1)

	reader := flux.FileLoader()
	qo := Quero(db)
	reader.Bind(qo, true)

	qo.React(func(r flux.Reactor, err error, d interface{}) {
		ws.Done()
		if err != nil {
			flux.FatalFailed(t, "Failed in Building sql.Statement, Error Received: %+s", err)
		}
		log.Printf("Model data: %+q", d)
		flux.LogPassed(t, "Successful created sql.Statement")
	}, true)

	reader.Send("./../../fixtures/models.dq")

	defer qo.Close()

	ws.Wait()

	dropTables(t, db)
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:35,代碼來源:sql_test.go

示例10: TestChunkParserCombo

func TestChunkParserCombo(t *testing.T) {
	var ws sync.WaitGroup
	ws.Add(1)

	fs := ChunkFileScanAdaptor()
	ps := ParseAdaptor(parser.DefaultInspectionFactory)

	fs.Bind(ps, true)

	fs.React(func(rs flux.Reactor, err error, data interface{}) {
		ws.Done()

		if err != nil {
			flux.FatalFailed(t, "Error occured string: %v", err.Error())
		}

		if _, ok := data.(ds.Graphs); ok {
			flux.FatalFailed(t, "Expected type ds.Graphs: %v", data)
		}

		flux.LogPassed(t, "Completed with parser Graph from ChunckFileScanner and Parser Combo")
	}, true)

	fs.Send("./../fixtures/dataset.dq")

	ws.Wait()
	fs.Close()
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:28,代碼來源:adapters_test.go

示例11: expect

func expect(t *testing.T, v, m interface{}) {
	if v != m {
		flux.FatalFailed(t, "Value %+v and %+v are not a match", v, m)
		return
	}
	flux.LogPassed(t, "Value %+v and %+v are a match", v, m)
}
開發者ID:influx6,項目名稱:relay,代碼行數:7,代碼來源:utils.go

示例12: dropTables

func dropTables(t *testing.T, db *sql.DB) {
	_, err := db.Exec("DROP TABLE IF EXISTS test.users")

	if err != nil {
		flux.FatalFailed(t, "Failed sql drop test.users table: %+s", err)
	}

	flux.LogPassed(t, "Successfully exectuable DROP table to sql db: %+s", "test.users")

	_, err = db.Exec("DROP TABLE IF EXISTS test.photos")

	if err != nil {
		flux.FatalFailed(t, "Failed sql drop test.photos table: %+s", err)
	}

	flux.LogPassed(t, "Successfully exectuable DROP table to sql db: %+s", "test.photos")
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:17,代碼來源:sql_test.go

示例13: TestCollector

func TestCollector(t *testing.T) {
	c := NewCollector()

	c.Set("name", "bond")

	if !c.HasMatch("name", "bond") {
		flux.FatalFailed(t, "unable to match added key %s and value %s", "name", "bond")
	}

	flux.LogPassed(t, "correctly matched added key %s and value %s", "name", "bond")
}
開發者ID:influx6,項目名稱:relay,代碼行數:11,代碼來源:collector_test.go

示例14: TestChunkScannerWithLargePack

func TestChunkScannerWithLargePack(t *testing.T) {
	var ws sync.WaitGroup
	ws.Add(2)

	fs := ChunkScanAdaptor()

	fs.React(func(rs flux.Reactor, err error, data interface{}) {
		ws.Done()

		if err != nil {
			flux.FatalFailed(t, "Error occured string: %v", err.Error())
		}

		if _, ok := data.(string); !ok {
			t.Fatalf("Expected type string: %v", data)
		}

		flux.LogPassed(t, "Completed with scanning with ChunkScanner")
	}, true)

	fs.Send(`
			{
			  user(){
			    id(is: 4000),
			    name,
			    state,
			    address,
			    skills(range: 30..100),
			    age(lt:30, gte:40),
			    age(is: 20),
			    day(isnot: wednesday),
			    photos(width: 400){
			      day,
			      fax,
			    },
			  },
			  admin(id:4,rack:10){
			    name,
			    email,
			    group,
			    levels,
			    permissions(){
			      code,
			      active,
			    },
			  },
			}
	`)

	ws.Wait()

	fs.Close()
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:53,代碼來源:adapters_test.go

示例15: TestTodoModel

func TestTodoModel(t *testing.T) {
	db := makeMockDb()

	if _, err := db.FindID(1); err != nil {
		flux.FatalFailed(t, "Todo id: %d should exists", 1)
	}

	flux.LogPassed(t, "Todo id: %d was located succesfully", 1)

	if err := db.Destroy(2); err != nil {
		flux.FatalFailed(t, "Todo id: %d was not destroyed", 2)
	}

	flux.LogPassed(t, "Todo id: %d was destroyed succesfully", 2)

	if todos, _ := db.FindAll(); len(todos) > 3 {
		flux.FatalFailed(t, "Todo length is not correct, epxected 2 got %d", len(todos))
	}

	flux.LogPassed(t, "Todo length: %d is correct", 2)
}
開發者ID:influx6,項目名稱:todo,代碼行數:21,代碼來源:model_test.go


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