open-nomad/helper/fields/schema_test.go
2023-04-10 15:36:59 +00:00

26 lines
455 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package fields
import "testing"
func TestFieldSchemaDefaultOrZero(t *testing.T) {
fs := &FieldSchema{
Type: TypeString,
Default: "default",
}
if d := fs.DefaultOrZero(); d != "default" {
t.Fatalf("bad: Expected: default Got: %s", d)
}
fs = &FieldSchema{
Type: TypeString,
}
if d := fs.DefaultOrZero(); d != "" {
t.Fatalf("bad: Expected: \"\" Got: %s", d)
}
}