Commit 2edb5814 authored by Geoff Simmons's avatar Geoff Simmons

Add Spec.ConfigName().

parent 163c3a6e
......@@ -153,3 +153,8 @@ func (spec Spec) DeepHash() string {
func (spec Spec) FQVersion() string {
return spec.Version + "-" + spec.Created.Format(RFC3339Micro)
}
func (spec Spec) ConfigName() string {
name := spec.FQVersion()
return vclIllegal.ReplaceAllLiteralString(name, "_")
}
......@@ -201,3 +201,10 @@ func TestFQVersion(t *testing.T) {
t.Fatal("FQVersion(): timestamp != Spec.Created", fqVersion)
}
}
func TestConfigName(t *testing.T) {
cfgName := testSpec.ConfigName()
if vclIllegal.MatchString(cfgName) {
t.Fatal("ConfigName() result is an illegal VCL name:", cfgName)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment