Skip to content

Commit

Permalink
optimize gocover
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJJJJJerk committed Dec 22, 2017
1 parent 3243e42 commit f89cae0
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 323 deletions.
7 changes: 2 additions & 5 deletions captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ func CaptchaWriteToFile(cap CaptchaInterface, outputDir, fileName, fileExt strin
return err
}
defer file.Close()
if _, err = cap.WriteTo(file); err == nil {
return nil
} else {
return err
}
_, err = cap.WriteTo(file)
return err
}

//CaptchaItem captcha basic information.
Expand Down
7 changes: 4 additions & 3 deletions captcha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ func TestCaptchaWriteToBase64Encoding(t *testing.T) {
func TestVerifyCaptcha(t *testing.T) {
idkey, _ := GenerateCaptcha("", configD)
verifyValue := globalStore.Get(idkey, false)
if verifyValue == "" {
t.Error("verify captcha content is failed.")
if VerifyCaptcha(idkey, verifyValue) {
t.Log(idkey, verifyValue)
} else {
t.Log(verifyValue)
t.Error("verify captcha content is failed.")

}
}
Loading

0 comments on commit f89cae0

Please sign in to comment.