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


Golang flux.FatalFailed函數代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: TestMarkdownStream

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

	mark, err := MarkFridayStream(MarkStreamConfig{
		InputDir: "../fixtures/markdown",
		SaveDir:  "../fixtures/templates",
		Ext:      ".html",
	})

	if err != nil {
		flux.FatalFailed(t, "Failed to build list streamer", err)
	}

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

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

示例7: 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

示例8: 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

示例9: 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

示例10: TestAssetMap

func TestAssetMap(t *testing.T) {
	tree, err := AssetTree("./", []string{".go"}, nil)

	if err != nil {
		flux.FatalFailed(t, "Unable to create asset map: %s", err.Error())
	}

	if len(tree) <= 0 {
		flux.FatalFailed(t, "expected one key atleast: %s")
	}

	flux.LogPassed(t, "Succesfully created asset map tree")
}
開發者ID:influx6,項目名稱:assets,代碼行數:13,代碼來源:assets_test.go

示例11: TestVirtualDir

func TestVirtualDir(t *testing.T) {
	if _, err := RootDirectory.GetDir("/"); err != nil {
		flux.FatalFailed(t, "Unable to located asset dir in dirCollection")
	}

	if _, err := RootDirectory.GetDir("/fixtures"); err != nil {
		flux.FatalFailed(t, "Unable to located /fixtures dir in dirCollection")
	}

	to, err := RootDirectory.GetDir("/fixtures/base")
	if err != nil {
		flux.FatalFailed(t, "Unable to located fixtures/base directory: %s", err)
	}

	al, err := to.GetFile("basic.tmpl")

	if err != nil {
		flux.FatalFailed(t, "Unable to located /fixtures/base/basic.tmpl file: %s", err)
	}

	if data, err := al.Data(); err != nil {
		flux.FatalFailed(t, "failed to load /fixtures/base/basic.tmpl contents: %s", err)
	} else if len(data) != 364 {
		flux.FatalFailed(t, "incorrect assets/tests/lock.md content, expected length %d got %d", 364, len(data))
	}

	if _, err := RootDirectory.GetFile("/fixtures/base/basic.tmpl"); err != nil {
		flux.FatalFailed(t, "Unable to get File /fixtures/base/basic.tmpl file: %s", err)
	}

	tom, _ := RootDirectory.GetDir("/fixtures")
	if _, err := tom.GetFile("/base/basic.tmpl"); err != nil {
		flux.FatalFailed(t, "Unable to get File /base/basic.tmpl file: %s", err)
	}
}
開發者ID:influx6,項目名稱:assets,代碼行數:35,代碼來源:prod_test.go

示例12: 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

示例13: 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

示例14: TestBadFileParser

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

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

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

	_, err = ps.Scan(fs)

	if err == nil {
		flux.FatalFailed(t, "Parser is supposed to error out about bad file")
	}

	flux.LogPassed(t, "Bad file failed properly: %+s", err)
}
開發者ID:influx6,項目名稱:dataquery,代碼行數:17,代碼來源:parser_test.go

示例15: 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


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