diff --git a/namedpipe/namepipe_windows_test.go b/namedpipe/namepipe_windows_test.go index f51bb0a3..e6b0c5e3 100644 --- a/namedpipe/namepipe_windows_test.go +++ b/namedpipe/namepipe_windows_test.go @@ -22,6 +22,14 @@ func TestParseServer(t *testing.T) { err = n.ParseServer(`\\.\pipe\MSSQL$Instance\sql\query`, c) assert.NoError(t, err, "ParseServer with a full pipe name") assert.Equal(t, "", c.Host, "Config Host with a full pipe name") + data, ok := c.ProtocolParameters[n.Protocol()] + assert.True(t, ok, "Should have added ProtocolParameters when server is pipe name") + switch d := data.(type) { + case namedPipeData: + assert.Equal(t, `\\.\pipe\MSSQL$Instance\sql\query`, d.PipeName, "Pipe name in ProtocolParameters when server is pipe name") + default: + assert.Fail(t, "Incorrect protocol parameters type:", d) + } c = &msdsn.Config{ Parameters: make(map[string]string), @@ -31,7 +39,7 @@ func TestParseServer(t *testing.T) { assert.NoError(t, err, "ParseServer .") assert.Equal(t, "localhost", c.Host, `Config Host with server == .\instance`) assert.Equal(t, "instance", c.Instance, `Config Instance with server == .\instance`) - _, ok := c.ProtocolParameters[n.Protocol()] + _, ok = c.ProtocolParameters[n.Protocol()] assert.Equal(t, ok, false, "Should have no namedPipeData when pipe name omitted") c = &msdsn.Config{ @@ -42,7 +50,7 @@ func TestParseServer(t *testing.T) { c.Parameters["pipe"] = `myinstance\sql\query` err = n.ParseServer(`anything`, c) assert.NoError(t, err, "ParseServer anything") - data, ok := c.ProtocolParameters[n.Protocol()] + data, ok = c.ProtocolParameters[n.Protocol()] assert.True(t, ok, "Should have added ProtocolParameters when pipe name is provided") switch d := data.(type) { case namedPipeData: