1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/namesgenerator/names-generator_test.go
Michael Crosby 0d2924408b Add -name for docker run
Remove docker link
Do not add container id as default name
Create an auto generated container name if not
specified at runtime.
2013-10-28 18:09:08 -07:00

28 lines
465 B
Go

package namesgenerator
import (
"testing"
)
type FalseChecker struct{}
func (n *FalseChecker) Exists(name string) bool {
return false
}
type TrueChecker struct{}
func (n *TrueChecker) Exists(name string) bool {
return true
}
func TestGenerateRandomName(t *testing.T) {
if _, err := GenerateRandomName(&FalseChecker{}); err != nil {
t.Error(err)
}
if _, err := GenerateRandomName(&TrueChecker{}); err == nil {
t.Error("An error was expected")
}
}