You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
staros/hosts/hosts_test.go

38 lines
710 B
Go

package hosts
import (
"fmt"
"testing"
)
func Test_Hosts(t *testing.T) {
var h = NewHosts()
err := h.Parse("./test_hosts.txt")
if err != nil {
t.Error(err)
}
for _, v := range h.List() {
fmt.Printf("%+v\n", v)
}
fmt.Println(h.nextUid, h.lastUid)
fmt.Println("")
err = h.AddHosts("122.23.12.123", "b612.me", "ok.b612.me")
if err != nil {
t.Error(err)
}
for _, v := range h.List() {
fmt.Printf("%+v\n", v)
}
fmt.Println(h.nextUid, h.lastUid)
fmt.Println("")
err = h.RemoveIPHosts("11.22.33.44", "remove.b612.me", "test.dns.set.b612.me")
if err != nil {
t.Error(err)
}
for _, v := range h.List() {
fmt.Printf("%+v\n", v)
}
fmt.Println(h.nextUid, h.lastUid)
fmt.Println("")
}