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


Golang TestLogBackend.Fatalf方法代碼示例

本文整理匯總了Golang中github.com/keybase/client/go/logger.TestLogBackend.Fatalf方法的典型用法代碼示例。如果您正苦於以下問題:Golang TestLogBackend.Fatalf方法的具體用法?Golang TestLogBackend.Fatalf怎麽用?Golang TestLogBackend.Fatalf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/keybase/client/go/logger.TestLogBackend的用法示例。


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

示例1: GetRootNodeOrBust

// GetRootNodeOrBust gets the root node for the given TLF name, which
// must be canonical, creating it if necessary, and failing if there's
// an error.
func GetRootNodeOrBust(
	t logger.TestLogBackend, config Config, name string, public bool) Node {
	n, err := GetRootNodeForTest(config, name, public)
	if err != nil {
		t.Fatalf("Couldn't get root node for %s (public=%t): %v",
			name, public, err)
	}
	return n
}
開發者ID:keybase,項目名稱:kbfs-beta,代碼行數:12,代碼來源:test_common.go

示例2: parseTlfHandleOrBust

// parseTlfHandleOrBust parses the given TLF name, which must be
// canonical, into a TLF handle, and failing if there's an error.
func parseTlfHandleOrBust(t logger.TestLogBackend, config Config,
	name string, public bool) *TlfHandle {
	ctx := context.Background()
	h, err := ParseTlfHandle(ctx, config.KBPKI(), name, public,
		config.SharingBeforeSignupEnabled())
	if err != nil {
		t.Fatalf("Couldn't parse %s (public=%t) into a TLF handle: %v",
			name, public, err)
	}
	return h
}
開發者ID:keybase,項目名稱:kbfs-beta,代碼行數:13,代碼來源:tlf_handle_test.go

示例3: testRPCWithCanceledContext

func testRPCWithCanceledContext(t logger.TestLogBackend,
	serverConn net.Conn, fn func(context.Context) error) {
	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		// Wait for RPC in fn to make progress.
		n, err := serverConn.Read([]byte{1})
		assert.Equal(t, n, 1)
		assert.NoError(t, err)
		cancel()
	}()

	err := fn(ctx)
	if err != context.Canceled {
		t.Fatalf("Function did not return a canceled error: %v", err)
	}
}
開發者ID:keybase,項目名稱:kbfs-beta,代碼行數:16,代碼來源:test_common.go

示例4: SwitchDeviceForLocalUserOrBust

// SwitchDeviceForLocalUserOrBust switches the current user's current device
func SwitchDeviceForLocalUserOrBust(t logger.TestLogBackend, config Config, index int) {
	name, uid, err := config.KBPKI().GetCurrentUserInfo(context.Background())
	if err != nil {
		t.Fatalf("Couldn't get UID: %v", err)
	}

	kbd, ok := config.KeybaseDaemon().(*KeybaseDaemonLocal)
	if !ok {
		t.Fatal("Bad keybase daemon")
	}

	if err := kbd.switchDeviceForTesting(uid, index); err != nil {
		t.Fatal(err.Error())
	}

	if _, ok := config.Crypto().(*CryptoLocal); !ok {
		t.Fatal("Bad crypto")
	}

	keySalt := keySaltForUserDevice(name, index)
	signingKey := MakeLocalUserSigningKeyOrBust(keySalt)
	cryptPrivateKey := MakeLocalUserCryptPrivateKeyOrBust(keySalt)
	config.SetCrypto(NewCryptoLocal(config, signingKey, cryptPrivateKey))
}
開發者ID:keybase,項目名稱:kbfs-beta,代碼行數:25,代碼來源:test_common.go


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