github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/fastly/validators_test.go (about) 1 package fastly 2 3 import "testing" 4 5 func TestValidateS3FormatVersion(t *testing.T) { 6 validVersions := []int{ 7 1, 8 2, 9 } 10 for _, v := range validVersions { 11 _, errors := validateS3FormatVersion(v, "format_version") 12 if len(errors) != 0 { 13 t.Fatalf("%q should be a valid format version: %q", v, errors) 14 } 15 } 16 17 invalidVersions := []int{ 18 0, 19 3, 20 4, 21 5, 22 } 23 for _, v := range invalidVersions { 24 _, errors := validateS3FormatVersion(v, "format_version") 25 if len(errors) != 1 { 26 t.Fatalf("%q should not be a valid format version", v) 27 } 28 } 29 }