package extsvc import "testing" // Club Log answers a refused login with its ordinary web page. The operator must // get a sentence they can act on, not four kilobytes of markup — that was the // first thing reported once the test started working at all. func TestLooksLikeHTML(t *testing.T) { cases := []struct { body string want bool }{ {"\n…403 - Access denied…", true}, {" 403", true}, {"", true}, {"Invalid credentials", false}, {"", false}, // An ADIF answer must never be mistaken for a page. {"\nF4BPO 20m ", false}, } for _, c := range cases { if got := looksLikeHTML(c.body); got != c.want { t.Errorf("looksLikeHTML(%.40q) = %v, want %v", c.body, got, c.want) } } }