当前位置: 首页>>代码示例>>Golang>>正文


Golang T.Failed方法代码示例

本文整理汇总了Golang中github.com/jingweno/gotask/tasking.T.Failed方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Failed方法的具体用法?Golang T.Failed怎么用?Golang T.Failed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/jingweno/gotask/tasking.T的用法示例。


在下文中一共展示了T.Failed方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TaskTestMySQL

// NAME
//   test-mysql - check data generated from ModSQL into a MySQL database
//
// DESCRIPTION
//
//   To create the database:
//
//     mysql -p
//     mysql> create database modsql_test;
//     mysql> GRANT ALL PRIVILEGES ON modsql_test.* to [email protected];
//
//   Note: substitute "USER" by your user name.
//
//   To remove it:
//
//     mysql> drop database modsql_test;
func TaskTestMySQL(t *tasking.T) {
	// Format used in "github.com/serbaut/go-mysql"
	//db, err := sql.Open("mysql", fmt.Sprintf("mysql://%[email protected](unix)/%s?socket=%s",
	//username, dbname, host.mysql))
	db, err := sql.Open("mysql", fmt.Sprintf("%[email protected](%s)/%s?parseTime=true",
		username, host.mysql, dbname))
	if err != nil {
		t.Fatal(err)
	}

	if err = modsql.Load(db, filepath.Join("data", "sql", "mysql_init.sql")); err != nil {
		t.Error(err)
	} else {
		if err = modsql.Load(db, filepath.Join("data", "sql", "mysql_test.sql")); err != nil {
			t.Error(err)
		}

		testInsert(t, db, modsql.MySQL)

		if err = modsql.Load(db, filepath.Join("data", "sql", "mysql_drop.sql")); err != nil {
			t.Error(err)
		}
	}

	db.Close()

	if !t.Failed() {
		t.Log("--- PASS")
	}
}
开发者ID:robfig,项目名称:modsql,代码行数:46,代码来源:mysql_task.go

示例2: TaskTestSQLite

// NAME
//   test-sqlite - check data generated from ModSQL into a SQLite database
func TaskTestSQLite(t *tasking.T) {
	filename := dbname + ".db"
	defer func() {
		if err := os.Remove(filename); err != nil {
			t.Error(err)
		}
	}()

	db, err := sql.Open("sqlite3", filename)
	if err != nil {
		t.Fatal(err)
	}

	if err = modsql.Load(db, filepath.Join("data", "sql", "sqlite_init.sql")); err != nil {
		t.Error(err)
	} else {
		if err = modsql.Load(db, filepath.Join("data", "sql", "sqlite_test.sql")); err != nil {
			t.Error(err)
		}

		testInsert(t, db, modsql.SQLite)

		if err = modsql.Load(db, filepath.Join("data", "sql", "sqlite_drop.sql")); err != nil {
			t.Error(err)
		}
	}

	db.Close()

	if !t.Failed() {
		t.Log("--- PASS")
	}
}
开发者ID:robfig,项目名称:modsql,代码行数:35,代码来源:sqlite_task.go

示例3: TaskTestPostgres

// NAME
//   check data generated from ModSQL into a Postgre database
//
// DESCRIPTION
//
//   To create the database:
//
//     sudo -u postgres createuser USER --no-superuser --no-createrole --no-createdb
//     sudo -u postgres createdb modsql_test --owner USER
//
//   Note: substitute "USER" by your user name.
//
//   To remove it:
//
//     sudo -u postgres dropdb modsql_test
func TaskTestPostgres(t *tasking.T) {
	db, err := sql.Open("postgres", fmt.Sprintf("user=%s dbname=%s host=%s sslmode=disable",
		username, dbname, host.postgres))
	if err != nil {
		t.Fatal(err)
	}

	if err = modsql.Load(db, filepath.Join("data", "sql", "postgres_init.sql")); err != nil {
		t.Error(err)
	} else {
		if err = modsql.Load(db, filepath.Join("data", "sql", "postgres_test.sql")); err != nil {
			t.Error(err)
		}

		testInsert(t, db, modsql.Postgres)

		if err = modsql.Load(db, filepath.Join("data", "sql", "postgres_drop.sql")); err != nil {
			t.Error(err)
		}
	}

	db.Close()

	if !t.Failed() {
		t.Log("--- PASS")
	}
}
开发者ID:robfig,项目名称:modsql,代码行数:42,代码来源:postgres_task.go

示例4: TaskClean

// NAME
//    clean - Clean all generated files
//
// DESCRIPTION
//    Clean all generated files and paths.
//
func TaskClean(t *tasking.T) {
	var paths []string

	paths = append(
		paths,
		ARMBinaryPath,
		"pkg",
		filepath.Join("bin"),
		filepath.Join(AndroidPath, "bin"),
		filepath.Join(AndroidPath, "gen"),
		filepath.Join(AndroidPath, "libs"),
		filepath.Join(AndroidPath, "obj"),
	)

	// Actually remove files using rm
	for _, path := range paths {
		err := rm_rf(t, path)
		if err != nil {
			t.Error(err)
		}
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
开发者ID:remogatto,项目名称:gltext,代码行数:32,代码来源:test_task.go

示例5: TaskDeploy

// NAME
//    deploy - Deploy the application
//
// DESCRIPTION
//    Build and deploy the application on the device via ant.
//
// OPTIONS
//    --verbose, -v
//        run in verbose mode
func TaskDeploy(t *tasking.T) {
	deployAndroid(t)
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Build and deploy the application on the device via ant.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Build and deploy the application on the device via ant.")
}
开发者ID:remogatto,项目名称:gltext,代码行数:16,代码来源:test_task.go

示例6: TaskClean

// NAME
//    clean - Clean all generated files
//
// DESCRIPTION
//    Clean all generated files and paths.
//
// OPTIONS
//    --backup, -b
//        clean all backup files (*~, #*)
//    --verbose, -v
//        run in verbose mode
func TaskClean(t *tasking.T) {
	var paths []string

	paths = append(
		paths,
		ARMBinaryPath,
		"pkg",
		filepath.Join("bin", ProjectName),
		filepath.Join(AndroidPath, "bin"),
		filepath.Join(AndroidPath, "gen"),
		filepath.Join(AndroidPath, "libs"),
		filepath.Join(AndroidPath, "obj"),
	)

	// Actually remove files using rm
	for _, path := range paths {
		err := rm_rf(t, path)
		if err != nil {
			t.Error(err)
		}
	}

	if t.Flags.Bool("backup") {
		err := t.Exec(`sh -c`, `"find ./ -name '*~' -print0 | xargs -0 rm -f"`)
		if err != nil {
			t.Error(err)
		}
	}

	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
开发者ID:leonardyp,项目名称:mandala,代码行数:45,代码来源:test_task.go

示例7: TaskInit

// NAME
//   init - Initialize a new Mandala application
//
// DESCRIPTION
//    Initialize a new Mandala application based on application.json
//
func TaskInit(t *tasking.T) {
	var err error

	// read application.json
	app, err := readJSON(jsonPath)
	if err != nil {
		t.Error(err)
	}

	var paths []string

	// execute templates and copy the files
	err = filepath.Walk(
		"templates",
		func(path string, info os.FileInfo, err error) error {
			if !info.IsDir() {
				paths = append(paths, path)
			}
			return nil
		},
	)
	if err != nil {
		t.Error(err)
	}

	for _, path := range paths {
		var dstPath string
		splits := strings.Split(path, "/")
		if len(splits) > 1 {
			dstPath = filepath.Join(splits[1:]...)
		} else {
			dstPath = filepath.Base(path)
		}
		if err = copyFile(path, dstPath, app); err != nil {
			t.Error(err)
		}
	}

	// Rename paths accordly to app.LibName

	if err = os.Rename("_task.go", strings.ToLower(app.LibName)+"_task.go"); err != nil {
		t.Error(err)
	}

	if err = os.Rename("src/_app", filepath.Join("src", strings.ToLower(app.LibName))); err != nil {
		t.Error(err)
	}

	if err = os.Rename("test/src/_app", filepath.Join("test/src/", strings.ToLower(app.TestLibName))); err != nil {
		t.Error(err)
	}

	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Initialize a new Mandala application")
	}

	t.Logf("%-20s %s\n", status(t.Failed()), "Initialize a new Mandala application")
}
开发者ID:remogatto,项目名称:mandala-template,代码行数:64,代码来源:init_task.go

示例8: TaskCrossCompileAll

// Cross-compiles gh for all supported platforms.
//
// Cross-compiles gh for all supported platforms. The build artifacts
// will be in target/VERSION. This only works on darwin with Vagrant setup.
func TaskCrossCompileAll(t *tasking.T) {
	t.Log("Removing build target...")
	err := os.RemoveAll("target")
	if err != nil {
		t.Errorf("Can't remove build target: %s\n", err)
		return
	}

	// for current
	t.Logf("Compiling for %s...\n", runtime.GOOS)
	TaskCrossCompile(t)
	if t.Failed() {
		return
	}

	// for linux
	t.Log("Compiling for linux...")
	err = t.Exec("vagrant ssh -c 'cd ~/src/github.com/jingweno/gh && git pull origin master && gotask cross-compile'")
	if err != nil {
		t.Errorf("Can't compile on linux: %s\n", err)
		return
	}
}
开发者ID:johnbellone,项目名称:gh,代码行数:27,代码来源:gh_task.go

示例9: TaskBuild

// NAME
//    build - Build the application
//
// DESCRIPTION
//    Build the application for the given platforms.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass FLAGS to the compiler
//    --verbose, -v
//        run in verbose mode
func TaskBuild(t *tasking.T) {
	for _, platform := range t.Args {
		buildFun[platform](t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
}
开发者ID:remogatto,项目名称:mandala-examples,代码行数:20,代码来源:chipmunk_task.go

示例10: TaskTest

// NAME
//    test - Run black-box tests
//
// DESCRIPTION
//    Build and run the application on the given platforms.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass the flags to the executable
//    --logcat=Mandala:* stdout:* stderr:* *:S
//        show logcat output (android only)
//    --verbose, -v
//        run in verbose mode
func TaskTest(t *tasking.T) {
	TaskBuild(t)
	for _, platform := range t.Args {
		runFun[platform](t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Run the application on the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Run the application on the given platforms.")
}
开发者ID:remogatto,项目名称:gltext,代码行数:23,代码来源:test_task.go

示例11: TaskTest

// NAME
//    test - Run the tests
//
// DESCRIPTION
//    Build and run the tests on the given platform returning output using logcat.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass the given flags to the executable
//    --verbose, -v
//        run in verbose mode
func TaskTest(t *tasking.T) {
	TaskBuild(t)
	if f, ok := runFun[t.Args[0]]; ok {
		f(t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Run the example on the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Run the example on the given platforms.")
}
开发者ID:leonardyp,项目名称:mandala,代码行数:21,代码来源:test_task.go

示例12: TaskRelease

// NAME
//    release - Build the application in 'release mode'
//
// DESCRIPTION
//    Build the application for Android in 'release mode'.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass FLAGS to the compiler
//    --verbose, -v
//        run in verbose mode
func TaskRelease(t *tasking.T) {
	// Build app in 'release mode'
	buildAndroid(t, true)
	// Sign and 'zipalign' app
	signAndroid(t)
	// Check task
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Release the application for Android.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Release the application for Android.")
}
开发者ID:remogatto,项目名称:mandala-examples,代码行数:22,代码来源:chipmunk_task.go

示例13: TaskBuild

// NAME
//    build - Build the tests
//
// DESCRIPTION
//    Build the tests for the given platforms (xorg/android).
//
// OPTIONS
//    --buildflags=
//        pass the given flags to the compiler
//    --verbose, -v
//        run in verbose mode
func TaskBuild(t *tasking.T) {
	if len(t.Args) == 0 {
		t.Error("At least a platform name must be specified!")
	}
	if f, ok := buildFun[t.Args[0]]; ok {
		f(t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Build the tests for the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Build the tests for the given platforms.")
}
开发者ID:kebo,项目名称:gorgasm,代码行数:23,代码来源:test_task.go

示例14: TaskBuild

// NAME
//    build - Build the application
//
// DESCRIPTION
//    Build the application for the given platforms.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass FLAGS to the compiler
//    --verbose, -v
//        run in verbose mode
func TaskBuild(t *tasking.T) {
	if len(t.Args) < 1 {
		t.Error("You must specify a build platform!")
	} else {
		for _, platform := range t.Args {
			buildFun[platform](t)
		}
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
}
开发者ID:remogatto,项目名称:gltext,代码行数:24,代码来源:test_task.go


注:本文中的github.com/jingweno/gotask/tasking.T.Failed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。