123456789101112131415161718192021222324252627282930313233 |
- package internal
- import (
- "testing"
- "git.i2edu.net/i2/go-zero/core/netx"
- "github.com/stretchr/testify/assert"
- )
- func TestFigureOutListenOn(t *testing.T) {
- tests := []struct {
- input string
- expect string
- }{
- {
- input: "192.168.0.5:1234",
- expect: "192.168.0.5:1234",
- },
- {
- input: "0.0.0.0:8080",
- expect: netx.InternalIp() + ":8080",
- },
- {
- input: ":8080",
- expect: netx.InternalIp() + ":8080",
- },
- }
- for _, test := range tests {
- val := figureOutListenOn(test.input)
- assert.Equal(t, test.expect, val)
- }
- }
|