Upgrade Go to 1.6.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2016-02-17 19:05:52 -05:00 committed by Vincent Demeester
parent 5d648746e8
commit 2b140819b3
1 changed files with 13 additions and 11 deletions

View File

@ -6,15 +6,16 @@ import (
) )
func TestParseHost(t *testing.T) { func TestParseHost(t *testing.T) {
invalid := map[string]string{ invalid := []string{
"anything": "Invalid bind address format: anything", "anything",
"something with spaces": "Invalid bind address format: something with spaces", "something with spaces",
"://": "Invalid bind address format: ://", "://",
"unknown://": "Invalid bind address format: unknown://", "unknown://",
"tcp://:port": "Invalid bind address format: :port", "tcp://:port",
"tcp://invalid": "Invalid bind address format: invalid", "tcp://invalid",
"tcp://invalid:port": "Invalid bind address format: invalid:port", "tcp://invalid:port",
} }
valid := map[string]string{ valid := map[string]string{
"": DefaultHost, "": DefaultHost,
" ": DefaultHost, " ": DefaultHost,
@ -37,11 +38,12 @@ func TestParseHost(t *testing.T) {
"npipe:////./pipe/foo": "npipe:////./pipe/foo", "npipe:////./pipe/foo": "npipe:////./pipe/foo",
} }
for value, errorMessage := range invalid { for _, value := range invalid {
if _, err := ParseHost(false, value); err == nil || err.Error() != errorMessage { if _, err := ParseHost(false, value); err == nil {
t.Errorf("Expected an error for %v with [%v], got [%v]", value, errorMessage, err) t.Errorf("Expected an error for %v, got [nil]", value)
} }
} }
for value, expected := range valid { for value, expected := range valid {
if actual, err := ParseHost(false, value); err != nil || actual != expected { if actual, err := ParseHost(false, value); err != nil || actual != expected {
t.Errorf("Expected for %v [%v], got [%v, %v]", value, expected, actual, err) t.Errorf("Expected for %v [%v], got [%v, %v]", value, expected, actual, err)