github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/helper/fields/schema_test.go (about) 1 package fields 2 3 import "testing" 4 5 func TestFieldSchemaDefaultOrZero(t *testing.T) { 6 fs := &FieldSchema{ 7 Type: TypeString, 8 Default: "default", 9 } 10 11 if d := fs.DefaultOrZero(); d != "default" { 12 t.Fatalf("bad: Expected: default Got: %s", d) 13 } 14 15 fs = &FieldSchema{ 16 Type: TypeString, 17 } 18 19 if d := fs.DefaultOrZero(); d != "" { 20 t.Fatalf("bad: Expected: \"\" Got: %s", d) 21 } 22 }