-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【課題2】 #19
base: master
Are you sure you want to change the base?
【課題2】 #19
Conversation
func main() { | ||
err := run() | ||
if err != nil { | ||
os.Exit(ExitCodeErr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エラーメッセージは出さない?
keepfile = ".gitkeep" | ||
) | ||
|
||
func SetupTest(t *testing.T, path string, isDir bool) func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一時ディレクトリを作って、コピーしてあとで全部消した方が楽そう
case true: | ||
err := os.Mkdir(path, os.ModePerm) | ||
if err != nil { | ||
t.Errorf("Setup Error : %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エラーが報告されたとしてもどうしようもないからt.Fatalf
の方がよさそう
if err != nil { | ||
t.Errorf("Setup Error : %v", err) | ||
} | ||
defer f.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エラー処理
|
||
img := image.NewRGBA(image.Rect(0, 0, 100, 100)) | ||
if err := jpeg.Encode(f, img, &jpeg.Options{Quality: 100}); err != nil { | ||
t.Errorf("Setup Error : %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Fatalf
} | ||
} | ||
|
||
func TestConvert(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
課題2
【TRY】io.Readerとio.Writer
kadai2/nas/doc/homework.md に記載
1回目の宿題のテストを作ってみて下さい
coverage: 89.1% of statements