課題2 tokunaga - #16
Open
t0w4 wants to merge 8 commits into
Open
Conversation
zoncoen
reviewed
Jun 28, 2018
|
|
||
| // 画像変換テスト | ||
| func TestConvertImage(t *testing.T) { | ||
| t.Helper() |
There was a problem hiding this comment.
t.Helper() はヘルパー関数側で呼ぶので、この場合 SetupTestConvertImage() の中で呼んであげるのが適切かと思います
zoncoen
reviewed
Jun 28, 2018
| } | ||
|
|
||
| // 画像変換テストの前後で変換後のファイルを削除する | ||
| func SetupTestConvertImage(t *testing.T, files []string) func() { |
| file, err := os.Open(filename) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "file open error: %v\n", err) | ||
| return err |
There was a problem hiding this comment.
一般的な話としてエラーを返してるならここで標準エラーに出力する必要はない気がしますね(エラーを出力するなら ConvertImage() を呼んだ側でやるほうが自然)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
テストヘルパー
0bf8f77
-> interfaceをDecode, Encode単位に分割
テーブル駆動テスト
->b73b1d4
リファクタリング
main処理からflagのパース,画像変換コマンド切り出し
->70d7d8b
参考:
https://github.com/hashicorp/atlas-upload-cli
https://deeeet.com/writing/2014/12/18/golang-cli-test/