Open izumin5210 opened 4 years ago
t
もメッセージも渡してないのに、魔法の力でなんか良い感じにアサーションしてエラーメッセージ出してくれるらしい
func TestOpenFile(t *testing.T) { f, err := os.Open("notfound") expect.Nil(err) err = f.Close() expect.True(err == nil) }
% go test --- FAIL: TestOpenFile (0.00s) check_test.go:12: expected: <nil>, got: open notfound: no such file or directory
前とばしちゃったやつ
[Go] 構造体オブジェクト初期化時にフィールド名を指定することを強制する #golangjp - My External Storage
これ知らなかった。^ 8月の記事なので僕が気づかなかっただけで読んでる人いそう
https://github.com/wantedly/gophers-code-reading-party/issues/36#issuecomment-560332601
pkg/expect
実験 https://play.golang.org/p/ok8NEDG9yPH
runtime.Stack
で取り出したトレースから t.tRunner(...
を探して、ポインタを引っこ抜いている
邪悪w
201912111900 ~ @ 5F Lounge, Wantedly, Inc. Tokyo HQ
WHY
Go 完全に理解したい
WHAT
とりあえず読みたいものを書いていきましょう!