carlos / todomvc-bakeoff Public

Clone
git clone https://amadan.net/carlos/todomvc-bakeoff

Plain git — no account needed to clone.

Download

Download this file

1package main
2
3import "testing"
4
5func TestCheckLoopback(t *testing.T) {
6 for addr, ok := range map[string]bool{
7 "127.0.0.1:8080": true,
8 "[::1]:8080": true,
9 "0.0.0.0:8080": false,
10 ":8080": false,
11 "10.0.0.5:8080": false,
12 "localhost:8080": false, // a name could resolve anywhere
13 "127.0.0.1": false,
14 } {
15 if err := checkLoopback(addr); (err == nil) != ok {
16 t.Errorf("checkLoopback(%q) = %v, want ok=%v", addr, err, ok)
17 }
18 }
19}
20