Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:41 +01:00
1 parent 0295eb1ad2
commit b8a493b93d
138 files changed
+1898 -57607

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
package util_test
import (
"testing"
"go.maze.io/harmon/internal/util"
)
func TestMakeAddr(t *testing.T) {
var (
testDefault = "localhost:80"
testCases = []struct {
Test string
Want string
}{
{"", testDefault},
{"81", "localhost:81"},
{"1.1.1.1", "1.1.1.1:80"},
{"foo", "foo:80"},
{":https", "localhost:https"},
{"1.2.3.4:", "1.2.3.4:80"},
}
)
for _, test := range testCases {
t.Run(test.Test, func(it *testing.T) {
v := util.MakeAddr(test.Test, testDefault)
if v != test.Want {
it.Fatalf("expected %q to return %q, got %q", test.Test, test.Want, v)
} else {
it.Logf("%q resolved to %q", test.Test, v)
}
})
}
}