forked from kevadesu/forgejo
Unit tests for token and update models
This commit is contained in:
parent
c0904f1942
commit
de8b73dd92
41 changed files with 11919 additions and 0 deletions
36
vendor/gopkg.in/testfixtures.v2/time.go
generated
vendored
Normal file
36
vendor/gopkg.in/testfixtures.v2/time.go
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
package testfixtures
|
||||
|
||||
import "regexp"
|
||||
|
||||
var (
|
||||
regexpDate = regexp.MustCompile("\\d\\d\\d\\d-\\d\\d-\\d\\d")
|
||||
regexpDateTime = regexp.MustCompile("\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d")
|
||||
regexpTime = regexp.MustCompile("\\d\\d:\\d\\d:\\d\\d")
|
||||
)
|
||||
|
||||
func isDate(value interface{}) bool {
|
||||
str, isStr := value.(string)
|
||||
if !isStr {
|
||||
return false
|
||||
}
|
||||
|
||||
return regexpDate.MatchString(str)
|
||||
}
|
||||
|
||||
func isDateTime(value interface{}) bool {
|
||||
str, isStr := value.(string)
|
||||
if !isStr {
|
||||
return false
|
||||
}
|
||||
|
||||
return regexpDateTime.MatchString(str)
|
||||
}
|
||||
|
||||
func isTime(value interface{}) bool {
|
||||
str, isStr := value.(string)
|
||||
if !isStr {
|
||||
return false
|
||||
}
|
||||
|
||||
return regexpTime.MatchString(str)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue