Skip to content

Commit

Permalink
test: replace log.fatal by t.fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
miaolz123 committed Sep 9, 2020
1 parent cc3009f commit f92fcaf
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions validate/validate_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package validate

import (
"log"
"testing"
)

Expand Down Expand Up @@ -42,7 +41,7 @@ func TestTagEmpty(t *testing.T) {

my := &myStruct{}
if err := V.Struct(my); err != nil {
log.Fatalln("TestTagEmpty failed")
t.Fatal("TestTagEmpty failed")
}
}

Expand All @@ -58,7 +57,7 @@ func TestExample(t *testing.T) {

my1 := &myStruct{}
if err := V.Struct(my1); err == nil {
log.Fatalln("TestExample my1 failed")
t.Fatal("TestExample my1 failed")
}

my2 := &myStruct{
Expand All @@ -67,7 +66,7 @@ func TestExample(t *testing.T) {
Gender: "FM",
}
if err := V.Struct(my2); err != nil {
log.Fatalln("TestExample my2 err:", err)
t.Fatal("TestExample my2 err:", err)
}
}

Expand All @@ -87,7 +86,7 @@ func TestDeep(t *testing.T) {

my1 := &myStruct{}
if err := V.Struct(my1); err == nil {
log.Fatalln("TestDeep my1 failed")
t.Fatal("TestDeep my1 failed")
}

my2 := &myStruct{
Expand All @@ -98,6 +97,6 @@ func TestDeep(t *testing.T) {
},
}
if err := V.Struct(my2); err != nil {
log.Fatalln("TestDeep my2 err:", err)
t.Fatal("TestDeep my2 err:", err)
}
}

0 comments on commit f92fcaf

Please sign in to comment.