Skip to content

Commit

Permalink
TEST: add dashcase test
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmatmati committed Dec 6, 2024
1 parent 2b0d1ac commit e7a2037
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions misc/stringutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,87 @@ func TestSanitizeFilename(t *testing.T) {
})
}
}

func TestDashCase(t *testing.T) {
tests := []struct {
fieldname string
dashcase string
}{
{fieldname: "Abortonclose", dashcase: "abortonclose"},
{fieldname: "AcceptInvalidHTTPRequest", dashcase: "accept-invalid-http-request"},
{fieldname: "AcceptInvalidHTTPResponse", dashcase: "accept-invalid-http-response"},
{fieldname: "Backlog", dashcase: "backlog"},
{fieldname: "Check", dashcase: "check"},
{fieldname: "Checkcache", dashcase: "checkcache"},
{fieldname: "Client", dashcase: "client"},
{fieldname: "ClientFin", dashcase: "client-fin"},
{fieldname: "Clitcpka", dashcase: "clitcpka"},
{fieldname: "ClitcpkaCnt", dashcase: "clitcpka-cnt"},
{fieldname: "Connect", dashcase: "connect"},
{fieldname: "Contstats", dashcase: "contstats"},
{fieldname: "DisableH2Upgrade", dashcase: "disable-h2-upgrade"},
{fieldname: "Disabled", dashcase: "disabled"},
{fieldname: "DontlogNormal", dashcase: "dontlog-normal"},
{fieldname: "Dontlognull", dashcase: "dontlognull"},
{fieldname: "DynamicCookieKey", dashcase: "dynamic-cookie-key"},
{fieldname: "Enabled", dashcase: "enabled"},
{fieldname: "ErrorLogFormat", dashcase: "error-log-format"},
{fieldname: "Fullconn", dashcase: "fullconn"},
{fieldname: "H1CaseAdjustBogusClient", dashcase: "h1-case-adjust-bogus-client"},
{fieldname: "H1CaseAdjustBogusServer", dashcase: "h1-case-adjust-bogus-server"},
{fieldname: "HashBalanceFactor", dashcase: "hash-balance-factor"},
{fieldname: "HTTPBufferRequest", dashcase: "http-buffer-request"},
{fieldname: "HTTPIgnoreProbes", dashcase: "http-ignore-probes"},
{fieldname: "HTTPKeepAlive", dashcase: "http-keep-alive"},
{fieldname: "HTTPNoDelay", dashcase: "http-no-delay"},
{fieldname: "HTTPPretendKeepalive", dashcase: "http-pretend-keepalive"},
{fieldname: "HTTPRequest", dashcase: "http-request"},
{fieldname: "HTTPUseHtx", dashcase: "http-use-htx"},
{fieldname: "HTTPUseProxyHeader", dashcase: "http-use-proxy-header"},
{fieldname: "HttpchkParams", dashcase: "httpchk-params"},
{fieldname: "Httpslog", dashcase: "httpslog"},
{fieldname: "IdleCloseOnResponse", dashcase: "idle-close-on-response"},
{fieldname: "IndependentStreams", dashcase: "independent-streams"},
{fieldname: "LogFormat", dashcase: "log-format"},
{fieldname: "LogFormatSd", dashcase: "log-format-sd"},
{fieldname: "LogHealthChecks", dashcase: "log-health-checks"},
{fieldname: "LogSeparateErrors", dashcase: "log-separate-errors"},
{fieldname: "LogTag", dashcase: "log-tag"},
{fieldname: "MaxKeepAliveQueue", dashcase: "max-keep-alive-queue"},
{fieldname: "Maxconn", dashcase: "maxconn"},
{fieldname: "Mode", dashcase: "mode"},
{fieldname: "MysqlCheckParams", dashcase: "mysql-check-params"},
{fieldname: "Name", dashcase: "name"},
{fieldname: "Nolinger", dashcase: "nolinger"},
{fieldname: "Persist", dashcase: "persist"},
{fieldname: "PgsqlCheckParams", dashcase: "pgsql-check-params"},
{fieldname: "PreferLastServer", dashcase: "prefer-last-server"},
{fieldname: "Queue", dashcase: "queue"},
{fieldname: "Retries", dashcase: "retries"},
{fieldname: "RetryOn", dashcase: "retry-on"},
{fieldname: "Server", dashcase: "server"},
{fieldname: "ServerFin", dashcase: "server-fin"},
{fieldname: "SmtpchkParams", dashcase: "smtpchk-params"},
{fieldname: "SocketStats", dashcase: "socket-stats"},
{fieldname: "SpliceAuto", dashcase: "splice-auto"},
{fieldname: "SpliceRequest", dashcase: "splice-request"},
{fieldname: "SpliceResponse", dashcase: "splice-response"},
{fieldname: "Srvtcpka", dashcase: "srvtcpka"},
{fieldname: "SrvtcpkaCnt", dashcase: "srvtcpka-cnt"},
{fieldname: "Tarpit", dashcase: "tarpit"},
{fieldname: "TCPSmartAccept", dashcase: "tcp-smart-accept"},
{fieldname: "TCPSmartConnect", dashcase: "tcp-smart-connect"},
{fieldname: "Tcpka", dashcase: "tcpka"},
{fieldname: "Tcplog", dashcase: "tcplog"},
{fieldname: "Transparent", dashcase: "transparent"},
{fieldname: "Tunnel", dashcase: "tunnel"},
}

for _, tt := range tests {
t.Run(tt.fieldname, func(t *testing.T) {
if got := DashCase(tt.fieldname); got != tt.dashcase {
t.Errorf("DashCase(%s) = %s, want %s", tt.fieldname, got, tt.dashcase)
}
})
}
}

0 comments on commit e7a2037

Please sign in to comment.