Skip to content

Commit

Permalink
Test utils.IsUnixAddr()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Jul 5, 2024
1 parent 6fd7556 commit a7d89b8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,26 @@ func TestMaxInt(t *testing.T) {
}
}

func TestIsUnixAddr(t *testing.T) {
subtests := []struct {
name string
input string
output bool
}{
{"empty", "", false},
{"slash", "/", true},
{"unix", "/tmp/sock", true},
{"ipv4", "192.0.2.1", false},
{"ipv6", "2001:db8::", false},
}

for _, st := range subtests {
t.Run(st.name, func(t *testing.T) {
require.Equal(t, st.output, IsUnixAddr(st.input))
})
}
}

func TestChanFromSlice(t *testing.T) {
t.Run("Nil", func(t *testing.T) {
ch := ChanFromSlice[int](nil)
Expand Down

0 comments on commit a7d89b8

Please sign in to comment.