標準出力に現れるべき文字列 ◦ err 結果がエラーになる場合は true app_test.go func TestApp(t *testing.T) { testCases := []struct { args []string want string err bool }{ {args: []string{"calc", "add", "-a", "1", "-b", "2"}, want: "3\n", err: false}, {args: []string{"calc", "sub", "-a", "1", "-b", "2"}, want: "-1\n", err: false}, {args: []string{"calc", "add"}, want: "Error: missing flags -a and/or -b\n", err: true}, {args: []string{"calc", "sub"}, want: "Error: missing flags -a and/or -b\n", err: true}, }