Skip to content

Commit 675b8a5

Browse files
committed
Fix Options.Validate test
1 parent 94f3382 commit 675b8a5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

kadai2/tanaka0325/imgconv/options_test.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
package imgconv
1+
package imgconv_test
22

33
import (
44
"testing"
5+
6+
"github.com/gopherdojo/dojo8/kadai2/tanaka0325/imgconv"
57
)
68

7-
func TestOption_validate(t *testing.T) {
9+
func TestOptionsValidate(t *testing.T) {
810
notAllowdExt := "not_allowed_ext"
911
jpg := "jpg"
1012
png := "png"
1113
allowedList := []string{jpg, png}
1214

1315
tests := []struct {
1416
name string
15-
options Options
17+
options imgconv.Options
1618
args []string
1719
isErr bool
1820
}{
1921
{
2022
name: "err:Options.From is not allowed",
21-
options: Options{
23+
options: imgconv.Options{
2224
From: &notAllowdExt,
2325
To: &png,
2426
},
@@ -27,7 +29,7 @@ func TestOption_validate(t *testing.T) {
2729
},
2830
{
2931
name: "err:Options.To is not allowed",
30-
options: Options{
32+
options: imgconv.Options{
3133
From: &jpg,
3234
To: &notAllowdExt,
3335
},
@@ -36,7 +38,7 @@ func TestOption_validate(t *testing.T) {
3638
},
3739
{
3840
name: "ok",
39-
options: Options{
41+
options: imgconv.Options{
4042
From: &jpg,
4143
To: &png,
4244
},
@@ -47,7 +49,7 @@ func TestOption_validate(t *testing.T) {
4749

4850
for _, tt := range tests {
4951
t.Run(tt.name, func(t *testing.T) {
50-
err := tt.options.validate(tt.args)
52+
err := tt.options.Validate(tt.args)
5153
if (tt.isErr && err == nil) || (!tt.isErr && err != nil) {
5254
t.Errorf("expect err is %t, but got err is %s", tt.isErr, err)
5355
}

0 commit comments

Comments
 (0)