30 lines
552 B
Go
30 lines
552 B
Go
package fastly
|
|
|
|
import "testing"
|
|
|
|
func TestValidateS3FormatVersion(t *testing.T) {
|
|
validVersions := []int{
|
|
1,
|
|
2,
|
|
}
|
|
for _, v := range validVersions {
|
|
_, errors := validateS3FormatVersion(v, "format_version")
|
|
if len(errors) != 0 {
|
|
t.Fatalf("%q should be a valid format version: %q", v, errors)
|
|
}
|
|
}
|
|
|
|
invalidVersions := []int{
|
|
0,
|
|
3,
|
|
4,
|
|
5,
|
|
}
|
|
for _, v := range invalidVersions {
|
|
_, errors := validateS3FormatVersion(v, "format_version")
|
|
if len(errors) != 1 {
|
|
t.Fatalf("%q should not be a valid format version", v)
|
|
}
|
|
}
|
|
}
|