mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
e6e320acc7
This facilitates the refactoring of commands.go. Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
24 lines
664 B
Go
24 lines
664 B
Go
package opts
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestValidateIP4(t *testing.T) {
|
|
if ret, err := ValidateIp4Address(`1.2.3.4`); err != nil || ret == "" {
|
|
t.Fatalf("ValidateIp4Address(`1.2.3.4`) got %s %s", ret, err)
|
|
}
|
|
|
|
if ret, err := ValidateIp4Address(`127.0.0.1`); err != nil || ret == "" {
|
|
t.Fatalf("ValidateIp4Address(`127.0.0.1`) got %s %s", ret, err)
|
|
}
|
|
|
|
if ret, err := ValidateIp4Address(`127`); err == nil || ret != "" {
|
|
t.Fatalf("ValidateIp4Address(`127`) got %s %s", ret, err)
|
|
}
|
|
|
|
if ret, err := ValidateIp4Address(`random invalid string`); err == nil || ret != "" {
|
|
t.Fatalf("ValidateIp4Address(`random invalid string`) got %s %s", ret, err)
|
|
}
|
|
|
|
}
|