Skip to content

Commit

Permalink
test: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
nekrassov01 committed Mar 12, 2024
1 parent d935ea5 commit 4c99932
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func Test_cli(t *testing.T) {
wantErr: false,
},
{
name: "skip out of range",
name: "skip_out_of_range",
args: []string{Name, "clf", "-s", "65535", filepath.Join("testdata", "log", "sample_clf.log")},
wantErr: false,
},
Expand All @@ -167,15 +167,30 @@ func Test_cli(t *testing.T) {
wantErr: false,
},
{
name: "glob_pattern",
name: "in+default",
args: []string{Name, "clf", "-i", "default", filepath.Join("testdata", "log", "sample_clf.log")},
wantErr: false,
},
{
name: "in+gz",
args: []string{Name, "clf", "-i", "gz", filepath.Join("testdata", "gz", "sample_clf.log.gz")},
wantErr: false,
},
{
name: "in+zip",
args: []string{Name, "clf", "-i", "zip", "-g", "*", filepath.Join("testdata", "zip", "sample_clf.log.zip")},
wantErr: false,
},
{
name: "glob_pattern error",
name: "in+zip+glob_pattern_error",
args: []string{Name, "clf", "-i", "zip", "-g", "[", filepath.Join("testdata", "zip", "sample_clf.log.zip")},
wantErr: true,
},
{
name: "in+invalid_type",
args: []string{Name, "clf", "-i", "", filepath.Join("testdata", "zip", "sample_clf.log.zip")},
wantErr: true,
},
{
name: "out+json",
args: []string{Name, "clf", "-o", "json", filepath.Join("testdata", "log", "sample_clf.log")},
Expand All @@ -202,37 +217,42 @@ func Test_cli(t *testing.T) {
wantErr: false,
},
{
name: "out+unknown_format",
args: []string{Name, "clf", "-o", "dummy", filepath.Join("testdata", "log", "sample_clf.log")},
name: "out+invalid_type",
args: []string{Name, "clf", "-o", "", filepath.Join("testdata", "zip", "sample_clf.log.zip")},
wantErr: true,
},
{
name: "no_zip+glob",
args: []string{Name, "clf", "-i", "gz", "-g", "*", filepath.Join("testdata", "zip", "sample_clf.log.zip")},
wantErr: true,
},
{
name: "completion bash",
name: "completion_bash",
args: []string{Name, "completion", "bash"},
wantErr: false,
},
{
name: "completion zsh",
name: "completion_zsh",
args: []string{Name, "completion", "zsh"},
wantErr: false,
},
{
name: "completion pwsh",
name: "completion_pwsh",
args: []string{Name, "completion", "pwsh"},
wantErr: false,
},
{
name: "completion unsupported",
name: "completion_unsupported",
args: []string{Name, "completion", "fish"},
wantErr: true,
},
{
name: "unknown flag provided",
name: "unknown_flag_provided",
args: []string{Name, "-1"},
wantErr: true,
},
{
name: "no flag provided",
name: "no_flag_provided",
args: []string{Name},
wantErr: true,
},
Expand Down

0 comments on commit 4c99932

Please sign in to comment.