Add unit test for missing port helper func

This commit is contained in:
Michael Schurter 2016-11-09 11:55:10 -08:00
parent a75e5b5803
commit fdc5aa5a50
1 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package agent
import (
"io/ioutil"
"net"
"os"
"path/filepath"
"reflect"
@ -541,3 +542,14 @@ func TestResources_ParseReserved(t *testing.T) {
}
}
func TestIsMissingPort(t *testing.T) {
_, _, err := net.SplitHostPort("localhost")
if missing := isMissingPort(err); !missing {
t.Errorf("expected missing port error, but got %v", err)
}
_, _, err = net.SplitHostPort("localhost:9000")
if missing := isMissingPort(err); missing {
t.Errorf("expected no error, but got %v", err)
}
}